From 65fb6dd5ac03362b966cb5e77287c254410a6024 Mon Sep 17 00:00:00 2001 From: Richard Frith-MacDonald Date: Wed, 9 Sep 2009 08:21:51 +0000 Subject: [PATCH] minor simplification git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28645 72102866-910b-0410-8b05-ffd578937521 --- Source/NSThread.m | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Source/NSThread.m b/Source/NSThread.m index 56b2b2a12..9d4c1eec7 100644 --- a/Source/NSThread.m +++ b/Source/NSThread.m @@ -90,6 +90,8 @@ #define PTHREAD_MIN_PRIORITY 0 #endif +extern NSTimeInterval GSTimeNow(void); + @interface NSAutoreleasePool (NSThread) + (void) _endThread: (NSThread*)thread; @end @@ -151,12 +153,11 @@ static NSNotificationCenter *nc = nil; void GSSleepUntilIntervalSinceReferenceDate(NSTimeInterval when) { - extern NSTimeInterval GSTimeNow(void); NSTimeInterval delay; // delay is always the number of seconds we still need to wait delay = when - GSTimeNow(); - if (delay <= 0) + if (delay <= 0.0) { sched_yield(); return; @@ -583,15 +584,7 @@ static void setThreadForCurrentThread(NSThread *t) + (void) sleepForTimeInterval: (NSTimeInterval)ti { - if (ti > 0.0) - { - GSSleepUntilIntervalSinceReferenceDate( - [NSDate timeIntervalSinceReferenceDate] + ti); - } - else - { - sched_yield(); - } + GSSleepUntilIntervalSinceReferenceDate(GSTimeNow() + ti); } /**