示例#1
0
BOOL
OSAcquireSpinLock(OSSpinLock *spinlock)
{
   OSTestThreadCancel();
   spinAcquireLock(spinlock);
   return TRUE;
}
示例#2
0
BOOL
OSReleaseSpinLock(OSSpinLock *spinlock)
{
   spinReleaseLock(spinlock);
   OSTestThreadCancel();
   return TRUE;
}
示例#3
0
void
OSSleepTicks(Time ticks)
{
   if (1) {
      OSTestThreadCancel();
      gLog->warn("Ignoring unimplemented OSSleepTicks");
      return;
   }

   auto thread = OSGetCurrentThread();

   OSLockScheduler();

   // Create the alarm user data
   auto data = OSAllocFromSystem<SleepAlarmData>();
   data->thread = thread;

   // Create an alarm to trigger wakeup
   auto alarm = OSAllocFromSystem<OSAlarm>();
   OSCreateAlarm(alarm);
   OSSetAlarmUserData(alarm, data);
   OSSetAlarm(alarm, ticks, pSleepAlarmHandler);

   // Sleep thread
   OSSleepThreadNoLock(nullptr);
   OSRescheduleNoLock();

   OSFreeToSystem(data);
   OSFreeToSystem(alarm);
   OSUnlockScheduler();
}
示例#4
0
BOOL
OSReleaseSpinLock(OSSpinLock *spinlock)
{
   auto result = spinReleaseLock(spinlock);
   OSTestThreadCancel();
   return result;
}
示例#5
0
BOOL
OSTryAcquireSpinLockWithTimeout(OSSpinLock *spinlock, int64_t timeout)
{
   OSTestThreadCancel();
   assert(false);
   return FALSE;
}
示例#6
0
BOOL
OSTryAcquireSpinLockWithTimeout(OSSpinLock *spinlock, OSTime timeout)
{
   OSTestThreadCancel();
   return spinTryLockWithTimeout(spinlock, timeout) ? TRUE : FALSE;
}
示例#7
0
BOOL
OSTryAcquireSpinLock(OSSpinLock *spinlock)
{
   OSTestThreadCancel();
   return spinTryLock(spinlock) ? TRUE : FALSE;
}