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:
1 parent
cb81dd020a
commit
6952fcffc0
1 file changed
+1
@@ -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