bug-gnustep
[Top][All Lists]
Advanced

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

Re: NSThread patch for foreign thread registration


From: Richard Frith-Macdonald
Subject: Re: NSThread patch for foreign thread registration
Date: Tue, 30 Sep 2003 20:07:38 +0100


On Monday, September 29, 2003, at 07:49 PM, Leigh Smith wrote:

I have a patch to NSThread that enables threads originating from outside GNUstep (such as timer based callbacks) to be registered and therefore usable within GNUstep, allowing NSAutorelease pools to be set up.

Thanks for the patch but ... I think it would do more harm than good, in that it would hide problems.

By the time the function your patch modifies (GSCurrentThread()) is called, a lot of other GNUstep code could have been executed without the GNUstep threading system having been notified that it is in a multi-threaded application, and there is therefore a lot of potential for thread safety problems to have manifested. If a program is using threads (other than via the NSThread API) to access GNUstep objects, it MUST register those threads first in order to maintain thread safety... registering them the first time they try to access the current NSThread object is too late.

I've modified the message printed when GSCurrentThread() can't find an NSThread object for the current thread ... hopefully it's more meaningful now.





reply via email to

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