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.
_______________________________________________
Gnustep-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnustep-dev