|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming | |
Help with Condition Variables
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) | |||||||||||||
|
Apple Doesn't Love You
|
Condition variables confuse me and google isn't really helping. Is there anybody who could explain their use to me?
|
|||||||||||||
|
|
|
|
#2 (permalink) | |||||||||||||
|
AMD Overclocker
|
http://www.cs.mtu.edu/~shene/NSF-3/e...ONITOR/CV.html
You might have already seen this page or perhaps not. I haven't used it before but it seems pretty straight forward. Seems similar to the unix signal handler. Some stuff from wiki: http://en.wikipedia.org/wiki/Monitor...tion_variables Relevant section of code Code:
conditionVariable {
int queueSize = 0;
semaphore lock;
semaphore waiting;
wait() {
lock.acquire();
queueSize++;
lock.release();
waiting.down();
}
signal() {
lock.acquire();
while (queueSize > 0){
queueSize--;
waiting.up();
}
lock.release();
}
}
Last edited by decompiled : 06-28-08 at 12:17 AM. |
|||||||||||||
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|