eyBuildLib API Reference : eyBuildLib

ebthreadvar

NAME

ebthreadvar - thread private variable library

ROUTINES

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.

DESCRIPTION

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.

INCLUDE

ebthreadvar.h


eyBuildLib : Routines

ebThreadVarLibInit( )

NAME

ebThreadVarLibInit( ) - initialize the thread variable library

SYNOPSIS

int ebThreadVarLibInit (void)

DESCRIPTION

This routine is to initialize the thread variable library. It can be called only once.

RETURNS

OK/ERROR

SEE ALSO

ebthreadvar


eyBuildLib : Routines

ebThreadVarLibCleanup( )

NAME

ebThreadVarLibCleanup( ) - cleanup the thread variable library

SYNOPSIS

int ebThreadVarLibCleanup (void)

DESCRIPTION

This routine is to clean up the thread variable library.

RETURNS

OK/ERROR

SEE ALSO

ebthreadvar


eyBuildLib : Routines

ebThreadVarAdd( )

NAME

ebThreadVarAdd( ) - add a thread key to current thread

SYNOPSIS

int ebThreadVarAdd
    (
    EBTHREAD_KEY * pkey
    )

DESCRIPTION

This routine is to add a thread key to current thread.

RETURNS

OK/ERROR

SEE ALSO

ebthreadvar


eyBuildLib : Routines

ebThreadVarDel( )

NAME

ebThreadVarDel( ) - remove a thread key from thread.

SYNOPSIS

int ebThreadVarDel
    (
    EBTHREAD_KEY * pkey
    )

DESCRIPTION

This routine is to remove a thread key from thread, which added by call ebThreadVarAdd( ).

RETURNS

OK/ERROR

SEE ALSO

ebthreadvar


eyBuildLib : Routines

ebThreadVarGet( )

NAME

ebThreadVarGet( ) - get the value of current thread variable by thread key

SYNOPSIS

void * ebThreadVarGet
    (
    EBTHREAD_KEY * pkey
    )

DESCRIPTION

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.

RETURNS

OK/ERROR

SEE ALSO

ebthreadvar


eyBuildLib : Routines

ebThreadVarSet( )

NAME

ebThreadVarSet( ) - set the thread variable value of current thread.

SYNOPSIS

int ebThreadVarSet
    (
    EBTHREAD_KEY * pkey,
    const void *   value
    )

DESCRIPTION

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.

RETURNS

OK/ERROR

SEE ALSO

ebthreadvar


eyBuildLib : Routines

ebthreadVarBind( )

NAME

ebthreadVarBind( ) - bind a new space onto the thread variable key.

SYNOPSIS

void * ebThreadVarBind
    (
    EBTHREAD_KEY * pkey,
    size_t         var_size
    )

DESCRIPTION

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.

RETURNS

pointer to the new space which binded into pkey, or NULL if error

SEE ALSO

ebthreadvar


eyBuildLib : Routines

ebThreadVarUnbind( )

NAME

ebThreadVarUnbind( ) - unbind a thread variable by key.

SYNOPSIS

int ebThreadVarUnbind
    (
    EBTHREAD_KEY * pkey
    )

DESCRIPTION

This routine is to unbind a thread variable by key. When unbind the key will be delete automaticly.

RETURNS

OK/ERROR

SEE ALSO

ebthreadvar