Use of Condition Variables

BlitzMax Forums/BlitzMax Programming/Use of Condition Variables

ImaginaryHuman(Posted 2009) [#1]
In this post by Brucey he talked about use of Condition Variables for threading, seemingly that you need to use it when you're inside a mutex lock so that it will temporarily unlock until a signal is sent..

http://www.blitzbasic.com/Community/posts.php?topic=80344#904757

But is it possible to just use WaitCondVar() without there necessarily being inside a mutex lock?

ie what I want to do is basically just put a thread on `pause` and await some kind of signal to have it resume execution.


ImaginaryHuman(Posted 2009) [#2]
Or maybe I need to use a semaphore, put the thread on hold and then PostSemaphore() to trigger it?


ImaginaryHuman(Posted 2009) [#3]
I think I figured this out by using a separate semaphore for each thread, WaitSemaphore() to stop the thread executing, and then PostSemaphore() to increment its counter, causing the thread to resume.