eyBuildLib API Reference : eyBuildLib
ebthreadvar - thread private variable library
ebThreadVarLibInit( ) - initialize the thread variable library
ebThreadVarLibCleanup( ) - cleanup the thread variable library
ebThreadVarAdd( ) - add a thread key to current thread
ebThreadVarDel( ) - remove a thread key from thread.
ebThreadVarGet( ) - get the value of current thread variable by thread key
ebThreadVarSet( ) - set the thread variable value of current thread.
ebthreadVarBind( ) - bind a new space onto the thread variable key.
ebThreadVarUnbind( ) - unbind a thread variable by key.
This library supplys routines for management thread private variables. In multi-thread application, you should use those routine protect you global variables.
This library support Win32, POSIX OS and VxWorks.
ebthreadvar.h
ebThreadVarLibInit( ) - initialize the thread variable library
int ebThreadVarLibInit (void)
This routine is to initialize the thread variable library. It can be called only once.
OK/ERROR
ebThreadVarLibCleanup( ) - cleanup the thread variable library
int ebThreadVarLibCleanup (void)
This routine is to clean up the thread variable library.
OK/ERROR
ebThreadVarAdd( ) - add a thread key to current thread
int ebThreadVarAdd ( EBTHREAD_KEY * pkey )
This routine is to add a thread key to current thread.
OK/ERROR
ebThreadVarDel( ) - remove a thread key from thread.
int ebThreadVarDel ( EBTHREAD_KEY * pkey )
This routine is to remove a thread key from thread, which added by call ebThreadVarAdd( ).
OK/ERROR
ebThreadVarGet( ) - get the value of current thread variable by thread key
void * ebThreadVarGet ( EBTHREAD_KEY * pkey )
This routine is to get the value of current thread variable by thread key. Before this routine is called, you should set the thread variable by call ebThreadVarSet( ) at first.
OK/ERROR
ebThreadVarSet( ) - set the thread variable value of current thread.
int ebThreadVarSet ( EBTHREAD_KEY * pkey, const void * value )
This routine is to set the thread variable value by thread key of current thread. Before this routine is called, you should add the thread variable by call ebThreadVarAdd( ) at first.
OK/ERROR
ebthreadVarBind( ) - bind a new space onto the thread variable key.
void * ebThreadVarBind ( EBTHREAD_KEY * pkey, size_t var_size )
This routine is to bind a new space onto the thread variable key. The paramamter var_size specifies the how many bytes will be new allocate before bind it onto thread variable key.
pointer to the new space which binded into pkey, or NULL if error
ebThreadVarUnbind( ) - unbind a thread variable by key.
int ebThreadVarUnbind ( EBTHREAD_KEY * pkey )
This routine is to unbind a thread variable by key. When unbind the key will be delete automaticly.
OK/ERROR