URL:
<http://savannah.gnu.org/bugs/?48179>
Summary: GSRegisterCurrentThread should send
NSWillBecomeMultiThreadedNotification
Project: GNUstep
Submitted by: lcampbel
Submitted on: Wed 08 Jun 2016 03:52:35 PM GMT
Category: Base/Foundation
Severity: 3 - Normal
Item Group: Bug
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
Lots of gnustep base classes use GSLazyLock. GSLazyLock is a class that does
nothing -- its lock and unlock methods are no-ops -- until the program becomes
multithreaded, which is announced using NSWillBecomeMultiThreadedNotification,
at which point GSLazyLock starts actually being a lock. The idea here is that
single-threaded programs shouldn't have to pay the cost of locking and
unlocking.
The problem is that this notification is sent only by -[NSThread start], so if
you create threads directly (using pthread_create, say) and never use NSThread
to create threads, the notification is never sent, and GSLazyLock does
nothing, causing havoc.
I think the best fix would be for [NSThread _createThreadForCurrentPthread] to
call gnustep_base_thread_callback().
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?48179>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
_______________________________________________
Bug-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-gnustep