libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
GblThread Struct Reference

#include <gimbal_thread.h>

Inheritance diagram for GblThread:
Collaboration diagram for GblThread:

Data Fields

union { 
 
   GblThreadClass *   pClass 
 
   GblObject   base 
 
};  
 
GblCallRecord returnStatus
 
volatile sig_atomic_t signalStatus
 
GBL_THREAD_STATE state
 
- Data Fields inherited from GblObject
union { 
 
   GblObjectClass *   pClass 
 
   GblBox   base 
 
};  
 
- Data Fields inherited from GblInstance
GblClasspClass
 

Related Symbols

(Note that these are not member symbols.)

Function Overload Macros

Macros providing default arguments for methods

#define GblThread_create(...)
 
#define GblThread_nanoSleep(...)
 
#define GblThread_exit(...)
 
Parent Thread Methods

Methods to be called from a parent thread

GblThreadGblThread_ref (const GblThread *pSelf)
 
GblRefCount GblThread_unref (GblThread *pSelf)
 
GblBool GblThread_isJoined (const GblThread *pSelf)
 
const char * GblThread_name (const GblThread *pSelf)
 
GBL_RESULT GblThread_setName (GblThread *pSelf, const char *pName)
 
GblClosureGblThread_closure (const GblThread *pSelf)
 
void GblThread_setClosure (GblThread *pSelf, GblClosure *pClosure)
 
GblThreadFn GblThread_callback (const GblThread *pSelf)
 
void GblThread_setCallback (GblThread *pSelf, GblThreadFn pCb)
 
GBL_RESULT GblThread_setPriority (GblThread *pSelf, GBL_THREAD_PRIORITY priority)
 
GBL_RESULT GblThread_setAffinity (GblThread *pSelf, GblThreadAffinity affinity)
 
GBL_RESULT GblThread_start (GblThread *pSelf)
 
GBL_RESULT GblThread_join (GblThread *pSelf)
 
GBL_RESULT GblThread_spinWait (GblThread *pSelf)
 
Child Thread Methods

Methods to be called from the spawned child thread

GblThreadGblThread_current (void)
 
GBL_RESULT GblThread_yield (void)
 

Detailed Description

Object representing a thread, its local storage, and logic.

GblThread encapsulates an operating system thread, its local storage, and the logic that is run within it.

See also
GblThreadClass

Definition at line 100 of file gimbal_thread.h.

Friends And Related Symbol Documentation

◆ GblThread_create

#define GblThread_create ( ...)
related

Provides default argument handling for GblThread_create()

Definition at line 208 of file gimbal_thread.h.

◆ GblThread_ref()

GblThread * GblThread_ref ( const GblThread * pSelf)
related

Returns a new reference to an existing thread, incrementing its reference count by 1.

◆ GblThread_unref()

GblRefCount GblThread_unref ( GblThread * pSelf)
related

Decrements the reference count of a GblThread instance, deleting it if it's the last one.

◆ GblThread_isJoined()

GblBool GblThread_isJoined ( const GblThread * pSelf)
related

Returns GBL_TRUE if the given thread has been joined with its parent and is done executing, GBL_FALSE otherwise.

◆ GblThread_name()

const char * GblThread_name ( const GblThread * pSelf)
related

Returns the string name assigned to the given thread.

◆ GblThread_setName()

GBL_RESULT GblThread_setName ( GblThread * pSelf,
const char * pName )
related

Sets the string name pName to be the name of the given thread.

◆ GblThread_closure()

GblClosure * GblThread_closure ( const GblThread * pSelf)
related

Returns the closure assigned to the given thread, or NULL if there isn't one.

◆ GblThread_setClosure()

void GblThread_setClosure ( GblThread * pSelf,
GblClosure * pClosure )
related

Assigns the closure of the given thread to pClosure, freeing the previous closure if there was one.

◆ GblThread_callback()

GblThreadFn GblThread_callback ( const GblThread * pSelf)
related

Returns the C callback function assigned to the given thread, or NULL if there isn't one.

◆ GblThread_setCallback()

void GblThread_setCallback ( GblThread * pSelf,
GblThreadFn pCb )
related

Assigns the C callback function of the given thread to pCb, which will be executed with the thread.

◆ GblThread_setPriority()

GBL_RESULT GblThread_setPriority ( GblThread * pSelf,
GBL_THREAD_PRIORITY priority )
related

Sets the priority of the given thread to priority.

◆ GblThread_setAffinity()

GBL_RESULT GblThread_setAffinity ( GblThread * pSelf,
GblThreadAffinity affinity )
related

Sets the CPU affinity of the given thread to affinity.

◆ GblThread_start()

GBL_RESULT GblThread_start ( GblThread * pSelf)
related

Immediately starts a thread which has not yet joined or finished executing.

◆ GblThread_join()

GBL_RESULT GblThread_join ( GblThread * pSelf)
related

Blocks execution of the current thread, awaiting the completion of the given thread.

◆ GblThread_spinWait()

GBL_RESULT GblThread_spinWait ( GblThread * pSelf)
related

Performs a non-blocking wait on the given thread, spinning on a timeout.

◆ GblThread_current()

GblThread * GblThread_current ( void )
related

Returns a pointer to the GblThread instance associatedw with the current thread.

◆ GblThread_yield()

GBL_RESULT GblThread_yield ( void )
related

Suspends execution of the current thread, allowing other threads to execute temporarily.

◆ GblThread_nanoSleep

#define GblThread_nanoSleep ( ...)
related

Provides default argument handling for GblThread_nanoSleep()

Definition at line 212 of file gimbal_thread.h.

◆ GblThread_exit

#define GblThread_exit ( ...)
related

Provides default argument handling for GblThread_exit()

Definition at line 210 of file gimbal_thread.h.

Field Documentation

◆ pClass

GblThreadClass* GblThread::pClass

Pointer to class/vtable structure.

Definition at line 100 of file gimbal_thread.h.

◆ base

GblObject GblThread::base

Inherited base instance structure.

Definition at line 100 of file gimbal_thread.h.

◆ returnStatus

GblCallRecord GblThread::returnStatus

Return information from a completed thread.

Definition at line 101 of file gimbal_thread.h.

◆ signalStatus

volatile sig_atomic_t GblThread::signalStatus

Pending signal state for a given thread.

Definition at line 102 of file gimbal_thread.h.

◆ state

GBL_THREAD_STATE GblThread::state

Current state for a given thread MAKE ME ATOMIC.

Definition at line 103 of file gimbal_thread.h.


The documentation for this struct was generated from the following file: