Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenlib/BLI_threads.h')
-rw-r--r--source/blender/blenlib/BLI_threads.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h
index 6ae833d5ed7..b4a465bbc74 100644
--- a/source/blender/blenlib/BLI_threads.h
+++ b/source/blender/blenlib/BLI_threads.h
@@ -181,6 +181,27 @@ bool BLI_thread_queue_is_empty(ThreadQueue *queue);
void BLI_thread_queue_wait_finish(ThreadQueue *queue);
void BLI_thread_queue_nowait(ThreadQueue *queue);
+
+/* Thread local storage */
+
+#if defined(__APPLE__)
+# define ThreadLocal(type) pthread_key_t
+# define BLI_thread_local_create(name) pthread_key_create(&name, NULL)
+# define BLI_thread_local_delete(name) pthread_key_delete(name)
+# define BLI_thread_local_get(name) pthread_getspecific(name)
+# define BLI_thread_local_set(name, value) pthread_setspecific(name, value)
+#else /* defined(__APPLE__) */
+# ifdef _MSC_VER
+# define ThreadLocal(type) __declspec(thread) type
+# else
+# define ThreadLocal(type) __thread type
+# endif
+# define BLI_thread_local_create(name)
+# define BLI_thread_local_delete(name)
+# define BLI_thread_local_get(name) name
+# define BLI_thread_local_set(name, value) name = value
+#endif /* defined(__APPLE__) */
+
#ifdef __cplusplus
}
#endif