Hi, sorry, just delete a couple lines of code, was trying to get mail
shorter, here's the complete code
#include <unistd.h>
#import <Foundation/Foundation.h>
@interface MyObj:NSObject
@end
@implementation MyObj
- (void) launch
{
// id p = [NSAutoreleasePool new];
NSLog(@"x");
//[p release];
}
@end
int main (int argc, const char * argv[]) {
id p = [NSAutoreleasePool new];
id obj = [MyObj new];
[NSThread detachNewThreadSelector:@selector(launch)
toTarget:obj withObject:nil];
[NSThread detachNewThreadSelector:@selector(launch)
toTarget:obj withObject:nil];
sleep(20);
return 0;
}
>> I got
>> Uncaught exception NSLockException, reason: failed to unlock mutex
>> But if I NSLock NSLog, it will log 2 "x"
>> Does this mean NSLog isn't thread-safe? or what do I miss?
>
> NSLog should be thread-safe.
>
> The code you provide is incomplete and certainly won't even compile, so we
> can't really tell what your problem might be.
>
> Please write a complete testcase demonstrating what your problem is...
>
> You can get the latest gnustep-make from svn trunk and try 'gnustep-tests
> --help' to get started ...
> There are example tests in $GNUSTEP_MAKEFILES/TestFramework
Thanks.
--
.----. Banlu Kemiyatorn
/.../\...\ 漫画家
|.../ \...| http://qstx.blogspot.com (Free Software Advocacy & Development)
|../ \..| http://feedbat.blogspot.com (Studio Work For Hire)
\/ \/ http://groundzerostudiocomplex.blogspot.com (Studio Research)
_______________________________________________
Gnustep-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnustep-dev