title: pthreads: perform function on main thread
body: <p>I'm looking for the analogous of Cocoa's </p>
  
  <p><code>-[NSObject performSelectorOnMainThread: withObject: waitUntilDone:]</code> </p>
  
  <p>method.</p>
  
  <p>So basically I have a function that does some work on a separate thread but it must perform some synchronous calls that need to be performed on the main one.</p>