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
Deprecated
Deprecated in favor of GblThread. Soon to be removed.
Author
Falco Girgis

Definition in file gimbal_thd.h.

Function Documentation

◆ GblThd_callRecord()

static GblCallRecord * GblThd_callRecord ( GblThd * pSelf)
inlinestatic

Definition at line 79 of file gimbal_thd.h.

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

◆ GblThd_stackFrameTop()

static GblStackFrame * GblThd_stackFrameTop ( const GblThd * pSelf)
inlinestatic

Definition at line 53 of file gimbal_thd.h.

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

◆ GblThd_stackFramePush()

static GBL_RESULT GblThd_stackFramePush ( GblThd * pSelf,
GblStackFrame * pFrame )
inlinestatic

Definition at line 58 of file gimbal_thd.h.

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

◆ GblThd_stackFramePop()

static GBL_RESULT GblThd_stackFramePop ( GblThd * pSelf)
inlinestatic

Definition at line 70 of file gimbal_thd.h.

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