Thread and sleep
Thread and sleep
- Subject: Thread and sleep
- From: "Peter Karlsson" <email@hidden>
- Date: Tue, 18 Jan 2005 17:39:08 +0100
Dear list!
I'm running a second thread and I want the thread to sleep until a NSButton
is pressed. Right now I'm checking the state of the button and if it's not
pressed I sleep for a while and repeat everything until the button is
pressed. Then the thread continue. Code fragment:
while ([myButtonOutlet state] != 1)
{
usleep(100000);
}
But it seems that this will not work if I do it more then one time in a
row. I must click the button twice for some reason sometimes to make the
thread continue. I don't know why.
Is there another and better way to do this?
Best regards Peter
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden