I am trying to understand the formula with an original which increases only when one button is pressed, and every time The button is pressed, a new thread starts rising on the same counter. Then I have a stop button to stop a thread, which is running. How can I tell how many threads, or which thread is going on? This is my original template on which I am working. Thank you.
- Count (integer) {return calculation; } - (zero) setcount: (int) value {count = value; } - (zero) update display {countLabel = [NSString stringWithformat: @ "% i", counting]; Count ++; } - (zero) myThread {NSAutoreleasePool * pool = [[NSAUTOriasius Alok] init]; [Self display selectorManaththread: @Selector (with update display) object: wait until zero: no]; [Bridge release]; } - (zero) startthread {{self display selector these backgrounds: object with @ selector (mythread): zero]; } - (zero) myThreadStop {NSAutoreleasePool * pool = [[NSAUTOriyipul Alok] Init]; [Self display selectorManaththread: @Selector (with update display) object: wait until zero: no]; [Bridge release]; } - (zero) stopthread {[Self-Performance Selector Inboxground @ Selector (Mathreststop) with Object: Zero]; }
Actually, you want to keep track of the number of running threads, and Also assign each thread to a unique ID. Assume that startThread is an event handler for your button, you might have something like this:
Fixed int thread index = 0; Static Int Threadsering = 0; - (zero) Restart start {NSNumber * ThreadID = [with NSNumber numbers: Threadindex ++]; ThreadsRunning ++; [Self-Performance Selector In-Background: @Selector (Mathrett) with Object: ThreadID]; } Then when you pause a thread, you only see threscing short
by looking at your code, however, I am confused I myThread method, ie, is not stopping the thread at all.
Comments
Post a Comment