mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
improve thread safety warning
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32604 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
41af4f10ad
commit
8e4f47717b
2 changed files with 12 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
2011-03-16 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSThread.m: Make +initialize thread safety warning optional
|
||||
(disabled using GSSilenceInitializeWarning user default) and more
|
||||
informative.
|
||||
|
||||
2011-03-15 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSNumberFormatter.m: Padding for fractional part comes at the
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
#import "Foundation/NSRunLoop.h"
|
||||
#import "Foundation/NSConnection.h"
|
||||
#import "Foundation/NSInvocation.h"
|
||||
#import "Foundation/NSUserDefaults.h"
|
||||
|
||||
#import "GSPrivate.h"
|
||||
#import "GSRunLoopCtxt.h"
|
||||
|
@ -385,7 +386,11 @@ gnustep_base_thread_callback(void)
|
|||
nc = RETAIN([NSNotificationCenter defaultCenter]);
|
||||
}
|
||||
#if !defined(HAVE_INITIALIZE)
|
||||
NSLog(@"WARNING your program is becoming multi-threaded, but you are using an ObjectiveC runtime library which does not have a thread-safe implementation of the +initialize method. This means that any classes not already used may be incorrectly initialised, potentially causing strange behaviors and crashes. Please build/run GNUstep-base with a runtime which supports the +initialize method.");
|
||||
if (NO == [[NSUserDefaults standardUserDefaults]
|
||||
boolForKey: @"GSSilenceInitializeWarning"])
|
||||
{
|
||||
NSLog(@"WARNING your program is becoming multi-threaded, but you are using an ObjectiveC runtime library which does not have a thread-safe implementation of the +initialize method. This means that any classes not already used may be incorrectly initialised, potentially causing strange behaviors and crashes.\nTo put this into context, the runtime bug has been knoown for several years and only rarely causes problems ... the easy workaround being to ensure that any classes used by a new thread have already been used in the main thread before the new thread starts.\nIf you are worried, please build/run GNUstep with a runtime which supports the +initialize method. The GNUstep stable runtime (libobjc) and experimental runtime (libobjc2), available from the GNUstep website and subversion repository, should both work.\nTo disable this warning (eg. for an application which does not suffer any problems caused by this runtime bug), please set the GSSilenceInitializeWarning user default to YES.");
|
||||
}
|
||||
#endif
|
||||
[nc postNotificationName: NSWillBecomeMultiThreadedNotification
|
||||
object: nil
|
||||
|
|
Loading…
Reference in a new issue