[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Thread question
From: |
Banlu Kemiyatorn |
Subject: |
Thread question |
Date: |
Wed, 2 Mar 2011 00:55:00 +0700 |
Hi,
I need help on NSThread, Here,s the code
@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];
/* some sleep */
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?
Thanks,
Banlu
--
.----. Banlu Kemiyatorn
/.../\...\ 漫画家
|.../ \...| http://qstx.blogspot.com (Free Software Advocacy & Development)
|../ \..| http://feedbat.blogspot.com (Studio Work For Hire)
\/ \/ http://groundzerostudiocomplex.blogspot.com (Studio Research)
- Thread question,
Banlu Kemiyatorn <=
- Re: Thread question, Richard Frith-Macdonald, 2011/03/01
- Re: Thread question, Banlu Kemiyatorn, 2011/03/01
- Re: Thread question, Richard Frith-Macdonald, 2011/03/02
- Re: Thread question, Richard Frith-Macdonald, 2011/03/02
- Re: Thread question, Banlu Kemiyatorn, 2011/03/04
- Re: Thread question, Richard Frith-Macdonald, 2011/03/04
- Re: Thread question, Banlu Kemiyatorn, 2011/03/04
- Re: Thread question, Richard Frith-Macdonald, 2011/03/05
- Re: Thread question, Philippe Roussel, 2011/03/07
- Re: Thread question, Richard Frith-Macdonald, 2011/03/07