BOOL OSWaitAlarm(OSAlarm *alarm) { OSAcquireSpinLock(gAlarmLock); assert(alarm); assert(alarm->tag == OSAlarm::Tag); if (alarm->state != OSAlarmState::Set) { OSReleaseSpinLock(gAlarmLock); return FALSE; } OSLockScheduler(); OSSleepThreadNoLock(&alarm->threadQueue); OSReleaseSpinLock(gAlarmLock); OSRescheduleNoLock(); OSUnlockScheduler(); return TRUE; }
BOOL ghsUnlock() { return OSReleaseSpinLock(ghsSpinLock); }