[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Thread question
From: |
Richard Frith-Macdonald |
Subject: |
Re: Thread question |
Date: |
Wed, 2 Mar 2011 06:21:12 +0000 |
On 1 Mar 2011, at 20:04, Banlu Kemiyatorn wrote:
> 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;
> }
>
OK ... that should build and run for you (and does for me) without trouble.
If it usually works, but fails, rarely, I guess there might be some race
condition in gnustep-base (but from looking at the source I can't see how that
could be).
If it fails consistently, I think there is something wrong with locking or
threading on your machine.
- Thread question, Banlu Kemiyatorn, 2011/03/01
- Re: Thread question, Richard Frith-Macdonald, 2011/03/01
- Re: Thread question, Banlu Kemiyatorn, 2011/03/01
- Re: Thread question,
Richard Frith-Macdonald <=
- 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
- Re: Thread question, Philippe Roussel, 2011/03/07
- Re: Thread question, Philippe Roussel, 2011/03/07
- Re: Thread question, Richard Frith-Macdonald, 2011/03/07