iPhone MultiThreading: List/Queue -


I'm finally going to send text commands to my Telnet iPhone app on a device, but I work on the device I am doing it as soon as I like it.

Now when I press a button, the phone sends a text command to the IP of the device. I want to change it so that a continuous process is going on and a queue is checking every .25 seconds is. If any element in the queue is sent, wait it for 25 seconds, then check it again.

My initial estimate is that I should check some iPhone threading libraries so that the button which can be added to the queue and send / tester method in different threads.

I was looking especially in the Operation Queue and Dispatch queue. Are these lines looking at me or are I completely shutting down here?

UPDATE :

I think what I want to read in NSThread NSMutableArray thread is not secure. Is there a list type queue or vector that secures the thread in Objective-C?

UPDATE 2 :

Can I use an instability and put a lock? Do I add or delete objects at all times?

You are on the right track Running a task at a regular time interval looks like a job This behavior Try to create such a timer:

  NSTimer * timer = [NSTimer Scheduled timer with timer: 0.25 target: self selector: @total User information: zero repeats: Yes];   

Set this object to an instance variable and it will run -doTask every 0.25 seconds. For your background tasks, and possibly your best bet, create custom NSOption subclasses and override the appropriate methods to run any work in the background.

Comments