Added.
authorPekka Riikonen <priikone@silcnet.org>
Sat, 15 Dec 2007 18:05:00 +0000 (18:05 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sat, 15 Dec 2007 18:05:00 +0000 (18:05 +0000)
lib/silcutil/silcthread_i.h [new file with mode: 0644]

diff --git a/lib/silcutil/silcthread_i.h b/lib/silcutil/silcthread_i.h
new file mode 100644 (file)
index 0000000..0038a61
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+
+  silcthread_i.h
+
+  Author: Pekka Riikonen <priikone@silcnet.org>
+
+  Copyright (C) 2007 Pekka Riikonen
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; version 2 of the License.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+*/
+
+#ifndef SILCTHREAD_I_H
+#define SILCTHREAD_I_H
+
+#ifndef SILCTHREAD_H
+#error "Do not include this header directly"
+#endif
+
+/* Thread-local storage structure.  This structure is saved to each thread's
+   Tls if the SILC Tls API is used.  This structure must be allocatable
+   with silc_calloc and freeable with silc_free, and must also be able to
+   pre-allocate from stack. */
+typedef struct SilcTlsObject {
+  void *thread_context;                       /* Context set with SILC Tls API */
+  void *platform_context;             /* Platform specific context */
+} *SilcTls, SilcTlsStruct;
+
+/* The internal Tls API.  Implementation is platform specific. */
+
+/* Initializes Tls for current thread.  Must be called for each thread to
+   allocate Tls for the thread, including the main thread. */
+SilcTls silc_thread_tls_init(void);
+
+/* Return current thread's Tls structure. */
+SilcTls silc_thread_get_tls(void);
+
+#endif /* SILCTHREAD_I_H */