mirror of
https://github.com/gnustep/libs-performance.git
synced 2025-02-15 16:11:14 +00:00
Make -drain: consider active threads
This commit is contained in:
parent
1a8c379be8
commit
4145d7e815
2 changed files with 5 additions and 5 deletions
|
@ -59,8 +59,8 @@
|
|||
*/
|
||||
+ (GSThreadPool*) sharedPool;
|
||||
|
||||
/** Waits until the pool of operations is empty or until the specified
|
||||
* timestamp. Returns YES if the pool was emptied, NO otherwise.
|
||||
/** Waits until the pool of operations is empty (and idle) or until the
|
||||
* specified timestamp. Returns YES if the pool was emptied, NO otherwise.
|
||||
*/
|
||||
- (BOOL) drain: (NSDate*)before;
|
||||
|
||||
|
@ -69,7 +69,7 @@
|
|||
*/
|
||||
- (NSUInteger) flush;
|
||||
|
||||
/** Returns humnan resdable pool statistics.
|
||||
/** Returns human resdable pool statistics.
|
||||
*/
|
||||
- (NSString*) info;
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ static GSThreadPool *shared = nil;
|
|||
|
||||
- (BOOL) drain: (NSDate*)before
|
||||
{
|
||||
BOOL result = [self isEmpty];
|
||||
BOOL result = ([self isEmpty] && [self isIdle]) ? YES : NO;
|
||||
|
||||
while (NO == result && [before timeIntervalSinceNow] > 0.0)
|
||||
{
|
||||
|
@ -146,7 +146,7 @@ static GSThreadPool *shared = nil;
|
|||
#else
|
||||
[NSThread sleepForTimeInterval: 0.1];
|
||||
#endif
|
||||
result = [self isEmpty];
|
||||
result = ([self isEmpty] && [self isIdle]) ? YES : NO;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue