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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2010-01-22 14:06:57 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2010-01-22 14:06:57 +0300
commit2d2339a70992b819a23e8c71f68027022b395f46 (patch)
tree747707ad2e7660e95e67b9c417feb5a619685072 /source/blender/blenlib/BLI_threads.h
parentcbc4aae06a9b3878b0af68884a75b953e3c8612b (diff)
Threads: added queue for passing data between threads. Includes a function
to wait for an item to be put in the queue and then pop immediately without, this makes it possible to avoid sleep() while waiting for the results of a thread.
Diffstat (limited to 'source/blender/blenlib/BLI_threads.h')
-rw-r--r--source/blender/blenlib/BLI_threads.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h
index ace9ddd729f..089ee9bdbdd 100644
--- a/source/blender/blenlib/BLI_threads.h
+++ b/source/blender/blenlib/BLI_threads.h
@@ -107,6 +107,21 @@ void BLI_destroy_worker(struct ThreadedWorker *worker);
* NOTE: inserting work is NOT thread safe, so make sure it is only done from one thread */
void BLI_insert_work(struct ThreadedWorker *worker, void *param);
+/* ThreadWorkQueue
+ *
+ * Thread-safe work queue to push work/pointers between threads. */
+
+typedef struct ThreadQueue ThreadQueue;
+
+ThreadQueue *BLI_thread_queue_init();
+void BLI_thread_queue_free(ThreadQueue *queue);
+
+void BLI_thread_queue_push(ThreadQueue *queue, void *work);
+void *BLI_thread_queue_pop(ThreadQueue *queue);
+void *BLI_thread_queue_pop_timeout(ThreadQueue *queue, int ms);
+int BLI_thread_queue_size(ThreadQueue *queue);
+
+void BLI_thread_queue_nowait(ThreadQueue *queue);
#endif