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:
authorJoseph Eagar <joeedh@gmail.com>2010-04-14 00:34:40 +0400
committerJoseph Eagar <joeedh@gmail.com>2010-04-14 00:34:40 +0400
commit0d557969b80c91d7efc9c5d33ede8aa902120271 (patch)
tree1db0821038e1b9f2b02cd36cf1eb50e4a02ca821
parent953d938ad19bc1dd81267ceb97e418fd84957532 (diff)
used private mutexes to avoid deadlocks
-rw-r--r--source/blender/blenlib/BLI_threads.h1
-rw-r--r--source/blender/gpu/intern/gpu_draw.c10
2 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h
index e3290873dc3..cf21707cd39 100644
--- a/source/blender/blenlib/BLI_threads.h
+++ b/source/blender/blenlib/BLI_threads.h
@@ -72,6 +72,7 @@ void BLI_unlock_thread(int type);
/* Mutex Lock */
typedef pthread_mutex_t ThreadMutex;
+#define BLI_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER;
void BLI_mutex_init(ThreadMutex *mutex);
void BLI_mutex_lock(ThreadMutex *mutex);
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 652902e3035..4ded9dc6162 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -785,11 +785,13 @@ void GPU_create_smoke(SmokeModifierData *smd, int highres)
}
ListBase image_free_queue = {NULL, NULL};
+static ThreadMutex queuelock = BLI_MUTEX_INITIALIZER;
+
static void flush_queued_free(void)
{
Image *ima, *imanext;
- BLI_lock_thread(LOCK_IMAGE);
+ BLI_mutex_lock(&queuelock);
ima = image_free_queue.first;
image_free_queue.first = image_free_queue.last = NULL;
@@ -799,16 +801,16 @@ static void flush_queued_free(void)
MEM_freeN(ima);
}
- BLI_unlock_thread(LOCK_IMAGE);
+ BLI_mutex_unlock(&queuelock);
}
static void queue_image_for_free(Image *ima)
{
Image *cpy = MEM_dupallocN(ima);
- BLI_lock_thread(LOCK_IMAGE);
+ BLI_mutex_lock(&queuelock);
BLI_addtail(&image_free_queue, cpy);
- BLI_unlock_thread(LOCK_IMAGE);
+ BLI_mutex_unlock(&queuelock);
}
void GPU_free_image(Image *ima)