discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Thread Question


From: Philip Knodle
Subject: Thread Question
Date: Mon, 25 Jun 2001 17:28:46 -0400

I'm having problems using the NSThread class.  When I run a program that uses
+[NSThread detachNewThreadSelector: toTarget:  withObject:], I get this error
Unable to detach thread (unknown error).  I'll attach the exact test
program that I used to generate this error at the end.

I'm using gcc version 3.0, and the daily snapshot of GNUStep.  I'm running on a
linux machine with kernel version 2.4.3.

//Begin test Program
#import <Foundation/NSThread.h>
#import <Foundation/NSObject.h>
#import <Foundation/NSAutoreleasePool.h>

#include <stdio.h>

@interface testClass : NSObject 
{ }
-threadMethod;
-threadStart;
@end

@implementation testClass
-threadMethod{
  printf("Thread Running\n");
}
-threadStart{
  printf("Trying to Start Thread.\n");
  [NSThread detachNewThreadSelector:@selector(threadMethod) 
            toTarget: self withObject:nil];
}
@end
 

int main(int argc, char* argv[]){
  NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
  testClass* foo = [[testClass alloc] init];
  [foo threadStart];
  [pool release];
}
//End Test Program
This is the output that the prgram generates:

philipkn:$ obj/threadTest 
Trying to Start Thread.
Jun 25 22:44:30 threadTest[1006] No local time zone specified.
Jun 25 22:44:30 threadTest[1006] Using time zone with absolute offset 0.
Jun 25 22:44:30 threadTest[1006] Unable to detach thread (unknown error)
philipkn:~/hacking/theta/hack$ 

I don't know if I'm calling the right method for threads, 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]