X-Git-Url: http://git.silcnet.org/gitweb/?p=runtime.git;a=blobdiff_plain;f=lib%2Fsilcutil%2Fsilcruntime.h.in;h=1c8ad88661ecdd1d4cce17dcea27cdbf28461d36;hp=9736eed5706e5111585004221561df167940ef8c;hb=4d96aec5a0942c3b9bf66dcbec47c593f267c5ec;hpb=5586a7f0e211638059148cc853e47caedf53d098 diff --git a/lib/silcutil/silcruntime.h.in b/lib/silcutil/silcruntime.h.in index 9736eed5..1c8ad886 100644 --- a/lib/silcutil/silcruntime.h.in +++ b/lib/silcutil/silcruntime.h.in @@ -17,6 +17,17 @@ */ +/****h* silcutil/Runtime Toolkit Interface + * + * DESCRIPTION + * + * The SILC Runtime Toolkit API is used to initialize and uninitialize the + * Runtime Toolkit. The application should call silc_runtime_init at the + * very start of the application and the silc_runtime_uninit at the very end + * of the application before it is exited. + * + ***/ + #ifndef SILCRUNTIME_H #define SILCRUNTIME_H @@ -202,6 +213,54 @@ extern "C" { #include #include +/* Runtime Toolkit API */ + +/****f* silcutil/silc_runtime_init + * + * SYNOPSIS + * + * static inline void silc_runtime_init(void) + * + * DESCRIPTION + * + * Initializes the Runtime Toolkit. Application should call this as the + * very first call to the Runtime Toolkit. The function initializes some + * of the Toolkit features. + * + ***/ +static inline +void silc_runtime_init(void) +{ + /* For now we don't have much here. Strictly speaking, calling this + currently isn't required. But in the future we may have something that + really must be initialized at the very start. Even the Tls doesn't + actually require initialization since any routine using Tls currently + takes care of that. */ + + /* Initialize Tls for this thread (probably main process thread). */ + silc_thread_tls_init(); +} + +/****f* silcutil/silc_runtime_uninit + * + * SYNOPSIS + * + * static inline void silc_runtime_uninit(void) + * + * DESCRIPTION + * + * Uninitializes the Runtime Toolkit. Application should call this as the + * very last call to the Runtime Toolkit. The function uninitializes and + * frees all allocated resources. + * + ***/ +static inline +void silc_runtime_uninit(void) +{ + /* Uninitialize the whole Tls system (not just one thread). */ + silc_thread_tls_uninit(); +} + #ifdef __cplusplus } #endif