bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #48179] GSRegisterCurrentThread should send NSWillBecomeMultiThread


From: Larry Campbell
Subject: [bug #48179] GSRegisterCurrentThread should send NSWillBecomeMultiThreadedNotification
Date: Wed, 8 Jun 2016 15:52:37 +0000 (UTC)
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/601.6.17 (KHTML, like Gecko) Version/9.1.1 Safari/601.6.17

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/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]