discuss-gnustep
[Top][All Lists]
Advanced

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

PlayingSound


From: Steve Van Voorst
Subject: PlayingSound
Date: Thu, 30 Aug 2012 22:22:51 +0000 (GMT)

 1) I'm new to GNUstep/Linux, coming from MacOS.
 2) Current Operating System = Ubuntu 12.04
 3) When I run the following code:

#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>

 int main()
 {
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
  [NSApplication sharedApplication];

  NSMenu *menu = [[NSMenu new]autorelease];
  [menu addItemWithTitle: @"Quit"  
        action: @selector (terminate:)  
        keyEquivalent: @"q"];
  [NSApp setMainMenu: menu];

  NSSound *sound = [NSSound soundNamed:@"Basso"];
  [sound play];
  [NSApp run];
  [pool drain];
  return 0;
 }

I get this ominous message:

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.
To 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.
If 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.
To 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.

How serious is this?  It runs without error on the Mac.  I am unable to tell if I am running libobjc2; it has been installed.  Where would I set GSSilenceInitializeWarning to YES?

I'm also curious what happened to NSBeep().  I hear nothing.  The above code does produce a sound.

Thanks for any help.

Steve Van Voorst
reply via email to

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