Re: Help: while(;;) loop vs. NSTimer / NSThread -*Fixed*
Re: Help: while(;;) loop vs. NSTimer / NSThread -*Fixed*
- Subject: Re: Help: while(;;) loop vs. NSTimer / NSThread -*Fixed*
- From: Hisaoki Nishida <email@hidden>
- Date: Wed, 23 Oct 2002 21:42:08 -0400
Thanks for explanation on NSTimer.
Today I realized that my problem was with the data structures I used
inside my run method inside my server object. I dispatched a thread (or
if I used a timer-- could it be the same cause for the error?) from my
delegate class, to run my run method located in my server class. So
maybe I thought, when you're in a thread you're not allowed to access
anything else outside the scope of the current thread? Because
[serverSocket socketID]; would certainly violate it!
I'm not totally sure if this really was the cause of my problem, but I
did this instead:
In my delegate:
- (void)runServer:(id)newObject
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// Instantiate our server with default or user port number.
server = [STServer serverWithPortNumber:kDefaultServerPortNumber];
[server run];
[pool release];
}
runServer is the method I pass to thread dispatcher, from my delegate.
*INSIDE* this I created my server object, used a for(;;) loop inside my
run method and now it's working.
If I'm wrong with my interpretation, let me know.
Thanks.
-Yuki
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.