X-Git-Url: http://git.silcnet.org/gitweb/?p=crypto.git;a=blobdiff_plain;f=lib%2Fsilcutil%2Fsilcthread.h;h=5afc0a03201cced36b4b3cd48fd75fcb81c830b8;hp=c439b38db611f64f1f85ba643b1b3e53f953fd59;hb=c6bb9e5e82ae3a2d667e826b9bd979cbe72e1493;hpb=0f330f9f731f0659b210c29109a4272c7c7f5380 diff --git a/lib/silcutil/silcthread.h b/lib/silcutil/silcthread.h index c439b38d..5afc0a03 100644 --- a/lib/silcutil/silcthread.h +++ b/lib/silcutil/silcthread.h @@ -30,6 +30,9 @@ * in the threads. The thread pool manages the threads creation and * destruction. * + * The interface also provides routines for accessing the Thread-local + * storage (Tls) on all supported platforms. + * ***/ #ifndef SILCTHREAD_H @@ -349,4 +352,38 @@ SilcUInt32 silc_thread_pool_num_free_threads(SilcThreadPool tp); ***/ void silc_thread_pool_purge(SilcThreadPool tp); +/****f* silcutil/SilcThreadAPI/silc_thread_tls_set + * + * SYNOPSIS + * + * void silc_thread_tls_set(void *context); + * + * DESCRIPTION + * + * Sets `context' into the Thread-local storage. Any previously set + * value will be replaced. This function may be called for the main + * thread also. This function may be called also if the program does + * not support threads. + * + * To retrieve the context from the Tls, call silc_thread_tls_get. + * + ***/ +void silc_thread_tls_set(void *context); + +/****f* silcutil/SilcThreadAPI/silc_thread_tls_get + * + * SYNOPSIS + * + * void *silc_thread_tls_get(void); + * + * DESCRIPTION + * + * Returns context from the Thread-local storage. If context has no been + * set for the current thread NULL will be returned. + * + ***/ +void *silc_thread_tls_get(void); + +#include "silcthread_i.h" + #endif