Fix possible deadlock when becoming multi-threaded.

This commit is contained in:
Frederik Seiffert 2020-07-06 21:33:06 +02:00
parent 8e97401783
commit a7e87824c0
2 changed files with 11 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2020-07-06 Frederik Seiffert <frederik@algoriddim.com>
* Source/NSThread.m: Fix possible deadlock when becoming multi-
threaded.
2020-06-14 Gregory John Casamento <greg.casamento@gmail.com>
* Headers/Foundation/NSKeyedArchiver.h

View file

@ -775,7 +775,6 @@ gnustep_base_thread_callback(void)
pthread_mutex_lock(&threadLock);
if (entered_multi_threaded_state == NO)
{
ENTER_POOL
/*
* For apple compatibility ... and to make things easier for
* code called indirectly within a will-become-multi-threaded
@ -783,6 +782,12 @@ gnustep_base_thread_callback(void)
* threaded BEFORE sending the notifications.
*/
entered_multi_threaded_state = YES;
/*
* Enter pool after setting flag, because -[NSAutoreleasePool
* allocWithZone:] calls GSCurrentThread(), which may end up
* calling this function, which would cause a deadlock.
*/
ENTER_POOL
NS_DURING
{
[GSPerformHolder class]; // Force initialization