Note that there are some explanatory texts on larger screens.

plurals
  1. POLow-level details of the implementation of performSelectorOnMainThread:
    text
    copied!<p>Was wondering if anyone knows, or has pointers to good documentation that discusses, the low-level implementation details of Cocoa's 'performSelectorOnMainThread:' method.</p> <p>My best guess, and one I think is probably pretty close, is that it uses mach ports or an abstraction on top of them to provide intra-thread communication, passing selector information along as part of the mach message.</p> <p>Right? Wrong? Thanks!</p> <p><strong>Update 09:39AMPST</strong></p> <p>Thank you Evan DiBiase and Mecki for the answers, but to clarify: I understand what happens in the run loop, but what I'm looking for an answer to is; "<em>where</em> is the method getting queued? <em>how</em> is the selector information getting passed into the queue?" Looking for more than Apple's doc info: I've read 'em</p> <p><strong>Update 14:21PST</strong></p> <p>Chris Hanson brings up a good point in a comment: my objective here is not to learn the underlying mechanisms in order to take advantage of them in my own code. Rather, I'm just interested in a better conceptual understanding of the process of signaling another thread to execute code. As I said, my own research leads me to believe that it's takes advantage of mach messaging for IPC to pass selector information between threads, but I'm specifically looking for <strong>concrete</strong> information on what is happening, so I can be sure I'm understanding things <em>correctly</em>. Thanks! </p> <p><strong>Update 03/06/09</strong></p> <p>I've opened a bounty on this question because I'd really like to see it answered, but if you are trying to collect please make sure you read <strong>everything</strong>, including all currently posed answers, comments to both these answers and to my original question, and the update text I posted above. I'm look for the <strong>lowest-level detail</strong> of the mechanism used by <code>performSelectorOnMainThread:</code> and the like, and as I mentioned earlier, I suspect it has something to do with Mach ports but I'd really like to know for sure. The bounty will not be awarded unless I can <strong>confirm</strong> the answer given is correct. Thanks everyone!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload