mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Avoid exposing pthread details in NSLock.h (as much as possible without
impacting performance). git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28612 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e772c54dfa
commit
b367e467d6
8 changed files with 929 additions and 18 deletions
|
@ -940,7 +940,7 @@ static inline BOOL timerInvalidated(NSTimer *t)
|
|||
GSIArrayRemoveItemAtIndex(timers, i);
|
||||
}
|
||||
}
|
||||
for (i = 0; recheck == NO && i < GSIArrayCount(timers); i++)
|
||||
for (i = 0; i < GSIArrayCount(timers); i++)
|
||||
{
|
||||
NSDate *d;
|
||||
|
||||
|
@ -1025,6 +1025,27 @@ static inline BOOL timerInvalidated(NSTimer *t)
|
|||
* the context.
|
||||
*/
|
||||
recheck = YES;
|
||||
/* It's possible that the system time was changed
|
||||
* while we have been running, and that the timer
|
||||
* which just fired caused another timer to be
|
||||
* scheduled using a time in the past relative to
|
||||
* 'now'. If we checked it again, we would fire it
|
||||
* again and could in this way end up repeatedly
|
||||
* firing a timer as fast as we possibly can until
|
||||
* the system time in in sync with 'now'.
|
||||
* To prevent this, we re-cache 'now' with the
|
||||
* current system time if that time is in the past.
|
||||
* We can't do that unconditionally though, because
|
||||
* doing so would defeat the whole point of caching
|
||||
* 'now' ... to prevent a repeated slow timed event
|
||||
* from continually firing.
|
||||
*/
|
||||
ti = GSTimeNow();
|
||||
if (ti < now)
|
||||
{
|
||||
now = ti;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue