Bläddra i källkod

* implement CThreadSwitch using sched_yield()

git-svn-id: trunk@7429 -
Jonas Maebe 18 år sedan
förälder
incheckning
3ab9ace8c4
1 ändrade filer med 7 tillägg och 2 borttagningar
  1. 7 2
      rtl/unix/cthreads.pp

+ 7 - 2
rtl/unix/cthreads.pp

@@ -284,10 +284,15 @@ Type  PINTRTLEvent = ^TINTRTLEvent;
     end;
 
 
+  procedure sched_yield; cdecl; external 'c' name 'sched_yield';
+
   procedure CThreadSwitch;  {give time to other threads}
     begin
-      {extern int pthread_yield (void) __THROW;}
-      {$Warning ThreadSwitch needs to be implemented}
+      { At least on Mac OS X, the pthread_yield_np calls through to this. }
+      { Further, sched_yield is in POSIX and supported on FreeBSD 4+,     }
+      { Linux, Mac OS X and Solaris, while the thread-specific yield      }
+      { routines are called differently everywhere and non-standard.      }
+      sched_yield;
     end;