mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 00:11:26 +00:00
Improve code for sleeping a bit.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17244 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
11822288e4
commit
a2309a4051
6 changed files with 2644 additions and 1581 deletions
|
@ -1926,36 +1926,11 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
NSDebugMLLog(@"NSRunLoop", @"no inputs in mode %@", mode);
|
||||
GSNotifyASAP();
|
||||
GSNotifyIdle();
|
||||
ti = [limit_date timeIntervalSinceNow];
|
||||
/*
|
||||
* Pause for as long as possible (up to the limit date)
|
||||
*/
|
||||
if (ti > 0.0)
|
||||
{
|
||||
#if defined(HAVE_USLEEP)
|
||||
if (ti >= INT_MAX / 1000000)
|
||||
{
|
||||
ti = INT_MAX;
|
||||
}
|
||||
else
|
||||
{
|
||||
ti *= 1000000;
|
||||
}
|
||||
usleep (ti);
|
||||
#elif defined(__MINGW__)
|
||||
if (ti >= INT_MAX / 1000)
|
||||
{
|
||||
ti = INT_MAX;
|
||||
}
|
||||
else
|
||||
{
|
||||
ti *= 1000;
|
||||
}
|
||||
Sleep (ti);
|
||||
#else
|
||||
sleep (ti);
|
||||
#endif
|
||||
}
|
||||
[NSThread sleepUntilDate: limit_date];
|
||||
ti = [limit_date timeIntervalSinceNow];
|
||||
GSCheckTasks();
|
||||
if (context != nil)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue