diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenlib/BLI_threads.h | 1 | ||||
-rw-r--r-- | source/blender/blenlib/intern/threads.c | 11 |
2 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h index 18b8feaa99c..b2ead15af22 100644 --- a/source/blender/blenlib/BLI_threads.h +++ b/source/blender/blenlib/BLI_threads.h @@ -175,6 +175,7 @@ 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); +bool BLI_thread_queue_is_empty(ThreadQueue *queue); void BLI_thread_queue_wait_finish(ThreadQueue *queue); void BLI_thread_queue_nowait(ThreadQueue *queue); diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c index 50295954192..73cadea71c0 100644 --- a/source/blender/blenlib/intern/threads.c +++ b/source/blender/blenlib/intern/threads.c @@ -777,6 +777,17 @@ int BLI_thread_queue_size(ThreadQueue *queue) return size; } +bool BLI_thread_queue_is_empty(ThreadQueue *queue) +{ + bool is_empty; + + pthread_mutex_lock(&queue->mutex); + is_empty = BLI_gsqueue_is_empty(queue->queue); + pthread_mutex_unlock(&queue->mutex); + + return is_empty; +} + void BLI_thread_queue_nowait(ThreadQueue *queue) { pthread_mutex_lock(&queue->mutex); |