mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-29 11:31:11 +00:00
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32314 72102866-910b-0410-8b05-ffd578937521
41 lines
939 B
Objective-C
41 lines
939 B
Objective-C
|
|
#import <Foundation/NSAutoreleasePool.h>
|
|
#import <Foundation/NSLock.h>
|
|
#import <Foundation/NSObject.h>
|
|
#import <Foundation/NSThread.h>
|
|
#import <Foundation/NSUserDefaults.h>
|
|
|
|
@interface MyClass : NSObject
|
|
+ (void) run;
|
|
@end
|
|
|
|
@implementation MyClass
|
|
+ (void) run
|
|
{
|
|
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
|
NSLock *lock = [NSLock new];
|
|
|
|
[lock lock];
|
|
[lock lock];
|
|
[arp release];
|
|
}
|
|
@end
|
|
|
|
int main()
|
|
{
|
|
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
|
|
|
/* We need the user defaults system set up to allow NSLog to query it
|
|
* when logging the deadlock message, but if the main thread is
|
|
* sleeping then it can't get set up. So we set it up before we
|
|
* start the test.
|
|
*/
|
|
[NSUserDefaults standardUserDefaults];
|
|
[NSThread detachNewThreadSelector: @selector(run)
|
|
toTarget: [MyClass class]
|
|
withObject: nil];
|
|
[NSThread sleepForTimeInterval: 1.0];
|
|
NSLog(@"Done.");
|
|
[arp release];
|
|
return 0;
|
|
}
|