libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gimbal_thd.h File Reference

Go to the source code of this file.

Data Structures

struct  GblThd
 

Functions

GblThdGblThd_current (void)
 
GblContextGblThd_context (const GblThd *pSelf)
 
const char * GblThd_name (const GblThd *pSelf)
 
GBL_RESULT GblThd_setName (GblThd *pSelf, const char *pName)
 
static GblCallRecordGblThd_callRecord (GblThd *pSelf)
 
GBL_RESULT GblThd_setCallRecord (GblThd *pSelf, const GblCallRecord *pRecord)
 
static GblStackFrameGblThd_stackFrameTop (const GblThd *pSelf)
 
static GBL_RESULT GblThd_stackFramePush (GblThd *pSelf, GblStackFrame *pFrame)
 
static GBL_RESULT GblThd_stackFramePop (GblThd *pSelf)
 
GBL_RESULT GblThd_logPush (GblThd *pSelf)
 
GBL_RESULT GblThd_logPop (GblThd *pSelf, uint32_t count)
 

Detailed Description

GblThd, legacy, deprecated thread API.

Deprecated:
Use gimbal_thread.h
Todo:
  • get rid of me
Author
Falco Girgis

Definition in file gimbal_thd.h.

Function Documentation

◆ GblThd_callRecord()

static GblCallRecord * GblThd_callRecord ( GblThd pSelf)
inlinestatic

Definition at line 80 of file gimbal_thd.h.

80 {
81 if(!pThread) {
82 pThread = GblThd_current();
83 }
84 return &pThread->callRecord;
85}

◆ GblThd_stackFrameTop()

static GblStackFrame * GblThd_stackFrameTop ( const GblThd pSelf)
inlinestatic

Definition at line 54 of file gimbal_thd.h.

54 {
55 if(!pThread) pThread = GblThd_current();
56 return pThread->pStackFrameTop;
57}

◆ GblThd_stackFramePush()

static GBL_RESULT GblThd_stackFramePush ( GblThd pSelf,
GblStackFrame pFrame 
)
inlinestatic

Definition at line 59 of file gimbal_thd.h.

59 {
60 if(!pThread) pThread = GblThd_current();
61 if(pFrame) {
62 pFrame->pPrevFrame = pThread->pStackFrameTop;
63 if(GBL_RESULT_ERROR(pThread->callRecord.result)) {
64 GblThd_setCallRecord(pThread, GBL_NULL);
65 }
66 }
67 pThread->pStackFrameTop = pFrame;
68 return GBL_RESULT_SUCCESS;
69}

◆ GblThd_stackFramePop()

static GBL_RESULT GblThd_stackFramePop ( GblThd pSelf)
inlinestatic

Definition at line 71 of file gimbal_thd.h.

71 {
72 if(!pThread) pThread = GblThd_current();
73 GBL_ASSERT(pThread->pStackFrameTop);
74 GblStackFrame* pPrevFrame = pThread->pStackFrameTop;
75 pThread->pStackFrameTop = pThread->pStackFrameTop? pThread->pStackFrameTop->pPrevFrame : GBL_NULL;
76 pPrevFrame->pPrevFrame = GBL_NULL;
77 return GBL_RESULT_SUCCESS;
78}
Represents a single function's stack frame, from GBL_CTX_BEGIN() to GBL_CTX_END()