You can't unlock a mutex from a thread other than the one that locked
it. You need semaphores instead! Generally speaking:
- Use mutexes to protect access to shared data between multiple threads
(to "lock" data).
- Use semaphores to cause one thread to wait until another thread has
provided a resource. When one thread is READING/CONSUMING data that
another is WRITING/PRODUCING, a semaphore is a good idea. (Caps because
these are the terms by which you'll hear this kind of thing discussed in
comp-sci lit...)
I chose this double lock design, because in theory... it will mean I
don't need to create and destroy threads all the time! I can keep on
using the main thread. And this... I think... should be more CPU
efficient, than a lock, correct?
You are right to keep the worker thread around and not create and
destroy threads all the time, assuming you can keep your total thread
count down to something sane (not 10000 threads).
cheers
Ben
--
Scenery Home Page: http://scenery.x-plane.com/
Scenery blog: http://xplanescenery.blogspot.com/
Plugin SDK: http://www.xsquawkbox.net/xpsdk/
Scenery mailing list: email@hidden
Developer mailing list: email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
PerfOptimization-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden