• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CFSocket in a library
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CFSocket in a library


  • Subject: Re: CFSocket in a library
  • From: Quinn <email@hidden>
  • Date: Thu, 3 Feb 2005 18:11:51 +0000

At 18:51 +0100 3/2/05, Eric Arlotti 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).

Sure.

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's no problem attaching your runloop sources to the main thread's runloop. The only difficulty is ensuring that the main thread runs its runloop when you need it to. Most GUI applications run their runloop continuously, so that's generally not a problem. Of course, if the main thread goes off to crunch some numbers without handling user events, your runloop sources will be deferred until the next time it runs its runloop.


You can also start your own preemptive thread and attach your runloop sources to that. However, if you do this you lose the primary advantage of runloops, that is, everything being nicely serialised.

S+E
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware
_______________________________________________
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


References: 
 >CFSocket in a library (From: Eric Arlotti <email@hidden>)

  • Prev by Date: Re: CFSocket in a library
  • Next by Date: Re: Substituting low level BSD stuff with spiffy Cocoa calls
  • Previous by thread: Re: CFSocket in a library
  • Next by thread: CFURLCreateDataAndPropertiesFromResource crash
  • Index(es):
    • Date
    • Thread