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>2013-07-08 21:56:51 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-07-08 21:56:51 +0400
commit3ce280e825cdd7bcbdd58cb10537a2aa11119ee3 (patch)
tree54328823ffa9f00932a98d21e2aa89c37584e530 /source/blender/blenlib/BLI_threads.h
parent861f9e10f7ea9d1d38130ecbc983fe8f8dac93d0 (diff)
Fix #35960, #36044: blender internal viewport rendering crash while editing data.
Now the viewport rendering thread will lock the main thread while it is exporting objects to render data. This is not ideal if you have big scenes that might block the UI, but Cycles does the same, and it's fairly quick because the same evaluated mesh can be used as for viewport drawing. It's the only way to get things stable until the thread safe dependency graph is here. This adds a mechanism to the job system for jobs to lock the main thread, using a new 'ticket mutex lock' which is a mutex lock that gives priority to the first thread that tries to lock the mutex. Still to solve: undo/redo crashes.
Diffstat (limited to 'source/blender/blenlib/BLI_threads.h')
-rw-r--r--source/blender/blenlib/BLI_threads.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h
index 331cac3ed76..154986936a2 100644
--- a/source/blender/blenlib/BLI_threads.h
+++ b/source/blender/blenlib/BLI_threads.h
@@ -131,6 +131,18 @@ void BLI_rw_mutex_free(ThreadRWMutex *mutex);
void BLI_rw_mutex_lock(ThreadRWMutex *mutex, int mode);
void BLI_rw_mutex_unlock(ThreadRWMutex *mutex);
+/* Ticket Mutex Lock
+ *
+ * This is a 'fair' mutex in that it will grant the lock to the first thread
+ * that requests it. */
+
+typedef struct TicketMutex TicketMutex;
+
+TicketMutex *BLI_ticket_mutex_alloc(void);
+void BLI_ticket_mutex_free(TicketMutex *ticket);
+void BLI_ticket_mutex_lock(TicketMutex *ticket);
+void BLI_ticket_mutex_unlock(TicketMutex *ticket);
+
/* ThreadedWorker
*
* A simple tool for dispatching work to a limited number of threads