On Wed, Sep 14, 2011 at 9:38 AM, Andreas Grosam <agro...@onlinehome.de> wrote:
> A "Synchronous Channel" (or Synchronous Queue) is a well known pattern used 
> in multithreading. Basically, it is used to "hand off" objects from one 
> thread to another, with the requirement that the "producer" waits until a 
> "consumer" took the object.

If you want to block the producer until its object is consumed, why
not use dispatch_sync?

void producer() {
  while (1) {
    dispatch_sync(consumer_queue, ^{
      dispatch_async(consumer_queue, ^{
        // consume the thing
      }
    }
  }
}

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to