Where xan I find an example of a serial dispatch queue?

Sent from my iPhone

On Apr 29, 2010, at 11:35 AM, Thomas Clement <thoma...@free.fr> wrote:

Just use a serial dispatch queue (or if you need to run pre-10.6 use an NSOperationQueue with a max concurrent count set to 1) and dispatch operations to the queue whenever you want. The operation passed to the queue should write some data to the socket.

Thomas

On Apr 29, 2010, at 2:26 PM, Paul Franz wrote:

I am trying to convert my Java code to Objective-C code and I have run into a problem. I have thread, that currently has a socket open and it
sits there and send packets of information through the socket.
Currently my queue code uses the wait/notifyAll methods in Java to put
the thread into a wait state (i.e. not actively checking and using
CPU) and to wake it up. The methods look like:

void push (String str)
{
 queue.add(str);
 notifyAll();
}

String pop ()
{
while (queue.isEmpty())
   {
   wait();
   }

return queue.remove();
}

How do you do the samething in Cocoa/Objective-C?

Paul Franz
_______________________________________________

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/thomascl%40free.fr

This email sent to thoma...@free.fr


_______________________________________________

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