Re: CFSocket in a library
Re: CFSocket in a library
- Subject: Re: CFSocket in a library
- From: Douglas Davidson <email@hidden>
- Date: Thu, 03 Feb 2005 10:03:33 -0800
On 2005-02-03 09:51:59 -0800 Eric Arlotti <email@hidden> wrote:
I would like to know it it's possible to use the CFSocket API in a
library
(in fact, a plugin for the 4th Dimension application).
I have to implement listening sockets and this means managing run
loops
concepts.
I am wondering if it's possible in a library that has no knowledge of
the
main application's threads and run loops ? Do I have to create my own
threads
and run loops ?
There is automatically a run loop for each thread, without you having
to do anything about it. However, there is no particular guarantee
that a given thread will run its run loop. In a Cocoa or Carbon
application, the run loop in the main thread is likely to be running
much of the time, because those frameworks use the run loop for their
event processing. In a secondary thread, the run loop probably will
not be run unless the application or library specifically runs it.
If you are going to be using the run loop from a plugin, you will want
to know something about the environment within which you will be
called, and the application's expectations for its plugins. Are you
going to be called from the main thread or from a secondary thread?
Are you expected to be called and return synchronously, or can you
call back into the application? Can you spawn new threads? It may
well be that you can simply make use of the main thread's run loop and
never have to worry about threading, but some documentation or
experimentation would be needed to determine this.
Douglas Davidson
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden