SerraAvenger
Cuz I can
- Reaction score
- 234
Code:
while (#PARAM(lock)) {
Wait(1.0, c_timeGame);
}
#PARAM(lock) = true;
#SUBFUNCS(actions)
#PARAM(lock) = false;
wth?
while (#PARAM(lock)) {
Wait(1.0, c_timeGame);
}
#PARAM(lock) = true;
#SUBFUNCS(actions)
#PARAM(lock) = false;
What is this?
If there's real multithreading, it doesn't.Seems to do what it's supposed to do.
Prevents threads from running a critical section more than one at a time.
// A
while (#PARAM(lock)) {
Wait(1.0, c_timeGame);
}
// B
#PARAM(lock) = true;
#SUBFUNCS(actions)
#PARAM(lock) = false;
Were you expecting a queue behaviour for the next thread to go in? It shouldn't be hard to implement as a separate function.
Yeah, that would suck. However, we are assuming that context switches may occur at any time. Perhaps Blizzard implemented it in a way that context switches only occur on waits? But it wouldn't be real multithreading then...