Re: Acquiring an NSConnection otherwise than by registered name?
Re: Acquiring an NSConnection otherwise than by registered name?
- Subject: Re: Acquiring an NSConnection otherwise than by registered name?
- From: Ken Thomases <email@hidden>
- Date: Wed, 29 Sep 2010 19:04:55 -0500
Hi Oleg,
On Sep 29, 2010, at 9:57 AM, Oleg Krupnov wrote:
> I tried -[NSConnection removeRunLoop:[NSRunLoop currentRunLoop]], but
> it doesn't seem to change anything.
Huh. I don't know what's going on there. You might consider opening a developer technical support incident with Apple to ask them for advice on how to achieve what you want. Those cost money, but probably not as much as your time.
> Well, I could live with it, because the server already works as
> multi-threaded, but the problem is that the new thread that is
> spawned, is not released if the request is handled in the main thread,
> when I call -invalidate on the connection. And there does not seem a
> way to get the thread created by runInNewThread to exit it manually,
> or is there?
Probably not, but you could re-implement -runInNewThread and make arrangements to terminate the thread on other occasions.
I think that an alternative implementation should just remove the connection from the current run loop and spawn a new thread. The method of the new thread would add the connection to its run loop and run the run loop indefinitely. You could change that to add your own signaling mechanism so that, when signaled, the thread would exit instead of looping through the run loop again.
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden