FreeBASIC  0.91.0
fb_thread.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FB_TLSGETCTX(id)   (FB_##id##CTX *)fb_TlsGetCtx( FB_TLSKEY_##id, sizeof( FB_##id##CTX ) );
 

Typedefs

typedef void(FBCALLFB_THREADPROC )(void *param)
 
typedef struct _FBTHREAD FBTHREAD
 
typedef struct _FBMUTEX FBMUTEX
 
typedef struct _FBCOND FBCOND
 

Enumerations

enum  {
  FB_TLSKEY_ERROR, FB_TLSKEY_DIR, FB_TLSKEY_INPUT, FB_TLSKEY_PRINTUSG,
  FB_TLSKEY_GFX, FB_TLSKEYS
}
 

Functions

FBCALL FBTHREADfb_ThreadCreate (FB_THREADPROC proc, void *param, ssize_t stack_size)
 
FBCALL void fb_ThreadWait (FBTHREAD *thread)
 
FBTHREADfb_ThreadCall (void *proc, int abi, ssize_t stack_size, int num_args,...)
 ThreadCall: Launches any procedure as new thread, based on libffi. More...
 
FBCALL FBMUTEXfb_MutexCreate (void)
 
FBCALL void fb_MutexDestroy (FBMUTEX *mutex)
 
FBCALL void fb_MutexLock (FBMUTEX *mutex)
 
FBCALL void fb_MutexUnlock (FBMUTEX *mutex)
 
FBCALL FBCONDfb_CondCreate (void)
 
FBCALL void fb_CondDestroy (FBCOND *cond)
 
FBCALL void fb_CondSignal (FBCOND *cond)
 
FBCALL void fb_CondBroadcast (FBCOND *cond)
 
FBCALL void fb_CondWait (FBCOND *cond, FBMUTEX *mutex)
 
FBCALL void * fb_TlsGetCtx (int index, size_t len)
 
FBCALL void fb_TlsDelCtx (int index)
 
FBCALL void fb_TlsFreeCtxTb (void)
 

Macro Definition Documentation

#define FB_TLSGETCTX (   id)    (FB_##id##CTX *)fb_TlsGetCtx( FB_TLSKEY_##id, sizeof( FB_##id##CTX ) );

Definition at line 49 of file fb_thread.h.

Typedef Documentation

typedef void(FBCALL * FB_THREADPROC)(void *param)

Definition at line 1 of file fb_thread.h.

typedef struct _FBCOND FBCOND

Definition at line 10 of file fb_thread.h.

typedef struct _FBMUTEX FBMUTEX

Definition at line 7 of file fb_thread.h.

typedef struct _FBTHREAD FBTHREAD

Definition at line 4 of file fb_thread.h.

Enumeration Type Documentation

anonymous enum
Enumerator
FB_TLSKEY_ERROR 
FB_TLSKEY_DIR 
FB_TLSKEY_INPUT 
FB_TLSKEY_PRINTUSG 
FB_TLSKEY_GFX 
FB_TLSKEYS 

Definition at line 32 of file fb_thread.h.

Function Documentation

FBCALL void fb_CondBroadcast ( FBCOND cond)

Definition at line 18 of file thread_cond.c.

FBCALL FBCOND* fb_CondCreate ( void  )

Definition at line 5 of file thread_cond.c.

Here is the call graph for this function:

FBCALL void fb_CondDestroy ( FBCOND cond)

Definition at line 10 of file thread_cond.c.

FBCALL void fb_CondSignal ( FBCOND cond)

Definition at line 14 of file thread_cond.c.

FBCALL void fb_CondWait ( FBCOND cond,
FBMUTEX mutex 
)

Definition at line 22 of file thread_cond.c.

FBCALL FBMUTEX* fb_MutexCreate ( void  )

Definition at line 5 of file thread_mutex.c.

Here is the caller graph for this function:

FBCALL void fb_MutexDestroy ( FBMUTEX mutex)

Definition at line 10 of file thread_mutex.c.

Here is the caller graph for this function:

FBCALL void fb_MutexLock ( FBMUTEX mutex)

Definition at line 14 of file thread_mutex.c.

FBCALL void fb_MutexUnlock ( FBMUTEX mutex)

Definition at line 18 of file thread_mutex.c.

FBTHREAD* fb_ThreadCall ( void *  proc,
int  abi,
ssize_t  stack_size,
int  num_args,
  ... 
)

ThreadCall: Launches any procedure as new thread, based on libffi.

For example:

FB code: declare sub MySub(x as integer, y as integer) thread = threadcall MySub(2, 3) threadwait thread

Turned into this by fbc: a = 2 b = 3 thread = fb_ThreadCall(, STDCALL, 2, INT, , INT, ) fb_ThreadWait(thread)

fb_ThreadCall() packs the call and parameter data it's given into an array of pointers and then launches a thread. The new thread reconstructs the call using LibFFI and then calls the user's procedure.

Definition at line 26 of file thread_call.c.

FBCALL FBTHREAD* fb_ThreadCreate ( FB_THREADPROC  proc,
void *  param,
ssize_t  stack_size 
)

Definition at line 5 of file thread_core.c.

Here is the call graph for this function:

FBCALL void fb_ThreadWait ( FBTHREAD thread)

Definition at line 10 of file thread_core.c.

FBCALL void fb_TlsDelCtx ( int  index)

Definition at line 40 of file thread_ctx.c.

Here is the caller graph for this function:

FBCALL void fb_TlsFreeCtxTb ( void  )

Definition at line 51 of file thread_ctx.c.

Here is the call graph for this function:

Here is the caller graph for this function:

FBCALL void* fb_TlsGetCtx ( int  index,
size_t  len 
)

Definition at line 28 of file thread_ctx.c.

Here is the caller graph for this function: