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:
authorTon Roosendaal <ton@blender.org>2006-12-21 18:44:46 +0300
committerTon Roosendaal <ton@blender.org>2006-12-21 18:44:46 +0300
commitaf60771ecad15c36ac99f7883cf0656b3d74cd4e (patch)
treed4c1826e6f43f2ac879aaf529a15319b464418e0 /source/blender/blenlib
parentbb6dc38f89f6889e5154327dab931b3db10d55db (diff)
Fix for threads usage. This solves the hanging 'render baking', cauused
by yesterdays commit. Now a designater LOCK_IMAGE is used for all image write/read.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_threads.h1
-rw-r--r--source/blender/blenlib/intern/threads.c9
2 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h
index 05a11d8c146..60ecce3f9d8 100644
--- a/source/blender/blenlib/BLI_threads.h
+++ b/source/blender/blenlib/BLI_threads.h
@@ -32,6 +32,7 @@
#define BLI_THREADS_H
/* one custom lock available now. can be extended */
+#define LOCK_IMAGE 0
#define LOCK_CUSTOM1 1
/* for tables, button in UI, etc */
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index f02bac9aef0..5300d11feb6 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -84,6 +84,7 @@ A sample loop can look like this (pseudo c);
************************************************ */
static pthread_mutex_t _malloc_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t _image_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t _custom1_lock = PTHREAD_MUTEX_INITIALIZER;
static int thread_levels= 0; /* threads can be invoked inside threads */
@@ -203,13 +204,17 @@ void BLI_end_threads(ListBase *threadbase)
void BLI_lock_thread(int type)
{
- if (type==LOCK_CUSTOM1)
+ if (type==LOCK_IMAGE)
+ pthread_mutex_lock(&_image_lock);
+ else if (type==LOCK_CUSTOM1)
pthread_mutex_lock(&_custom1_lock);
}
void BLI_unlock_thread(int type)
{
- if(type==LOCK_CUSTOM1)
+ if (type==LOCK_IMAGE)
+ pthread_mutex_unlock(&_image_lock);
+ else if(type==LOCK_CUSTOM1)
pthread_mutex_unlock(&_custom1_lock);
}