Fix potential deadlock in NSOperationQueue when exiting a background thread

This commit is contained in:
Wolfgang Lux 2025-04-08 16:06:29 +02:00
parent b39853e21a
commit f6e6b05f48
2 changed files with 6 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2025-04-08 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSOperation.m (_thread): Fix potential deadlock when
exiting a thread.
2025-04-01 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSOrderedSet.m: Fix for git issue #500

View file

@ -1043,12 +1043,12 @@ static NSOperationQueue *mainQueue = nil;
if ([internal->starting count] == 0)
{
// Idle for 5 seconds ... exit thread.
[internal->cond unlock];
[[[NSThread currentThread] threadDictionary]
removeObjectForKey: threadKey];
[internal->lock lock];
internal->threadCount--;
[internal->lock unlock];
[internal->cond unlock];
break;
}
/* An operation was added in the gap between the failed wait for