Re: Thread Communication Conceptual Question
Re: Thread Communication Conceptual Question
- Subject: Re: Thread Communication Conceptual Question
- From: Filipe Varela <email@hidden>
- Date: Thu, 2 Aug 2007 10:42:37 +0100
Hi Eyal
AFAIK, and based on something i wrote (check out www.dev6.com under
the blog section, release 1 of the flightcontroller code), if you do
signal handling, the signal handler is always executed on the main
thread. Could that be used to pass messages to the main thread in
your case?
You can do a simple debug. Call printf("I was executed on thread %x
\n", pthread_self()); inside the signal handler and printf("I'm
issuing a signal on thread %x\n", pthread_self()); Im my setup,
they're different.
Filipe
On 2007/08/02, at 10:21, Eyal Redler wrote:
Hi,
I think this is a rather basic threading issue but I'm not very
experienced with thread so I'd appreciate any help on the subject.
I'm writing a little library that needs to be integrated into both
Cocoa and Carbon applications. Because the library needs to be API
agnostic, I plan to use pthreads and Not NSThread but the library
is integrated (at the moment) within a Cococa application.
One of the library calls starts a thread which in turn calls a
callback routine. Since the callback executed inside the sub-
thread, I need to somehow cause some code to be executed on the
main thread but since the thread itself was not created by the
parent application I'm not sure I can use distributed objects, the
library can also start and stop the sub threads at its own discretion.
I thought about using DO but all the example code I saw was in the
context of communicating between threads that were created by me,
which is not the case here.
So, assuming I have a routine which is executed on an "unknown"
thread, what's the simplest way to pass a message to the main thread?
TIA
Eyal
_______________________________________________
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
_______________________________________________
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