• 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: Run Loops and CFMessagePorts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Run Loops and CFMessagePorts


  • Subject: Re: Run Loops and CFMessagePorts
  • From: Kurt Revis <email@hidden>
  • Date: Tue, 28 Feb 2006 23:23:15 -0800

The simplest way I ever found to do this was:

In your main thread;
1) create a run loop source using CFRunLoopSourceCreate()
2) add it to the main run loop using CFRunLoopAddSource()

In your work thread, later on:
3) call CFRunLoopSourceSignal(runLoopSource) to touch the run loop source
4) call CFRunLoopWakeUp(mainThreadRunLoop) to make the run loop wake up soon -- otherwise it may take a few seconds

This will cause the run loop source's callback to get called in the main thread.

Working code to do this is in MessageQueue.c in SnoizeMIDI, available here:
http://www.snoize.com/MIDIMonitor/Source/

I get the impression that, under the hood, the above process is doing basically the same thing as the CFMessagePort/NSPort stuff that you linked to below.


On Feb 28, 2006, at 12:51 PM, Wayne Anderson wrote:

BTW, I really don't need to send data in this case.  Just a simple signal to the application run loop will do.  I'm following the sample code in...

http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/articles/SocketComm.html

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Run Loops and CFMessagePorts (From: Wayne Anderson <email@hidden>)
 >Re: Run Loops and CFMessagePorts (From: William Stewart <email@hidden>)
 >Re: Run Loops and CFMessagePorts (From: Wayne Anderson <email@hidden>)

  • Prev by Date: Re: Run Loops and CFMessagePorts
  • Previous by thread: Re: Run Loops and CFMessagePorts
  • Next by thread: Re: Run Loops and CFMessagePorts
  • Index(es):
    • Date
    • Thread