Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Files | Data Structures | Macros | Typedefs | Functions

Files

file  afw_pool.h
 Adaptive Framework memory pool support header.
 

Data Structures

struct  afw_thread_s
 Struct for public part of afw_pool_t. More...
 

Macros

#define afw_thread_mutex_create   apr_thread_mutex_create
 Uses apr_thread_mutex_t asis.
 
#define afw_thread_mutex_lock   apr_thread_mutex_lock
 Uses apr_thread_mutex_t asis.
 
#define afw_thread_mutex_trylock   apr_thread_mutex_trylock
 Uses apr_thread_mutex_trylock asis.
 
#define afw_thread_mutex_unlock   apr_thread_mutex_unlock
 Uses apr_thread_mutex_unlock asis.
 
#define afw_thread_mutex_destroy   apr_thread_mutex_destroy
 Uses apr_thread_mutex_destroy asis.
 
#define AFW_THREAD_FUNCTION   APR_THREAD_FUNC
 Uses APR_THREAD_FUNC as AFW_THREAD_FUNCTION.
 
#define AFW_THREAD_MUTEX_LOCK(mutex, xctx)
 Macro to begin a mutex lock section. More...
 
#define AFW_THREAD_MUTEX_UNLOCK()
 Macro to end a mutex lock. More...
 

Typedefs

typedef void *(AFW_THREAD_FUNCTIONafw_thread_function_t) (const afw_thread_t *thread, void *arg)
 Typedef for thread start function.
 
typedef struct afw_thread_attr_s afw_thread_attr_t
 Typedef for afw_thread_attr.
 

Functions

afw_thread_attr_tafw_thread_attr_create (const afw_pool_t *p, afw_xctx_t *xctx)
 Create a thread attr. More...
 
const afw_thread_tafw_thread_create (afw_thread_attr_t *thread_attr, afw_thread_function_t start_function, void *start_function_arg, const afw_utf8_t *name, afw_integer_t thread_number, afw_xctx_t *xctx)
 Create a thread. More...
 
void afw_thread_join (const afw_thread_t *thread, afw_xctx_t *xctx)
 Join a thread. More...
 

Detailed Description

Thread support.

Macro Definition Documentation

◆ AFW_THREAD_MUTEX_LOCK

#define AFW_THREAD_MUTEX_LOCK (   mutex,
  xctx 
)
Value:
do { \
afw_thread_mutex_t *this_mutex; \
this_mutex = mutex; \
afw_thread_mutex_lock(mutex); \
AFW_TRY

Macro to begin a mutex lock section.

Parameters
xctxof caller.

Usage:

AFW_THREAD_MUTEX_LOCK(xctx) { ... a very small amount of code that doesn't call anything } AFW_THREAD_MUTEX_UNLOCK();

Definition at line 137 of file afw_thread.h.

◆ AFW_THREAD_MUTEX_UNLOCK

#define AFW_THREAD_MUTEX_UNLOCK ( )
Value:
afw_thread_mutex_unlock(this_mutex); \
} \
AFW_ENDTRY; \
} while(0)
#define AFW_FINALLY
Always executed regardless of error.
Definition: afw_error.h:702

Macro to end a mutex lock.

See AFW_THREAD_MUTEX_LOCK for usage.

Definition at line 151 of file afw_thread.h.

Function Documentation

◆ afw_thread_attr_create()

afw_thread_attr_t* afw_thread_attr_create ( const afw_pool_t p,
afw_xctx_t xctx 
)

Create a thread attr.

Parameters
pto use.
xctxof caller.
Returns
new thread attr.

Definition at line 19 of file afw_thread.c.

◆ afw_thread_create()

const afw_thread_t* afw_thread_create ( afw_thread_attr_t thread_attr,
afw_thread_function_t  start_function,
void *  start_function_arg,
const afw_utf8_t name,
afw_integer_t  thread_number,
afw_xctx_t xctx 
)

Create a thread.

Parameters
thread_attrto use.
start_functionto call when thread starts.
start_function_argto pass to start function.
nameto be associated with thread.
thread_numberto be associated with thread.
pto use.
xctxof caller.
Returns
new threadr.

Definition at line 41 of file afw_thread.c.

◆ afw_thread_join()

void afw_thread_join ( const afw_thread_t thread,
afw_xctx_t xctx 
)

Join a thread.

Parameters
threadto join.
xctxof caller.
Returns
new threadr.

Definition at line 71 of file afw_thread.c.