ConditionVariable / Monitor as extension to Mutex

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
NicTheQuick
Addict
Addict
Posts: 1224
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

ConditionVariable / Monitor as extension to Mutex

Post by NicTheQuick »

Hi there,

I would really appreciate If you could implement a ConditionVariable/Monitor as extension to the already knwon Mutex.

Semaphores might seem similar, but there are a completely different thing. See this lexture notes: Lec09_notes.pdf from Prashant Shenoy.

I have implemented my own ConditionVariable using Semaphores, but there is a problem. Because the Mutexes in PureBasic were acting like ReentrantLocks in Java, you have to count the calls to 'LockMutex()' and corresponding to that you have to call 'UnlockMutex()' for the waiting condition. Then after getting a signal you have to call 'LockMutex()' accordingly one or more times before return from the 'wait' method. This workaround makes programs slow.

It would be nice if PureBasic would implement the Monitor construct in a low level form.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
User avatar
NicTheQuick
Addict
Addict
Posts: 1224
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: ConditionVariable / Monitor as extension to Mutex

Post by NicTheQuick »

*push*
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Post Reply