Avoid recursive lockups in threadOnce while still ensuring that a
preempting task does not incorrectly determine that the `init' function has completed.
This commit is contained in:
@@ -362,6 +362,7 @@ void threadOnceOsd(threadOnceId *id, void(*func)(void *), void *arg)
|
||||
}
|
||||
semMutexMustTake(onceMutex);
|
||||
if (*id == 0) {
|
||||
*id = -1;
|
||||
func(arg);
|
||||
*id = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user