FROM : Kevin Elliott
DATE : Tue Nov 19 18:33:00 2002
NSThread's sleepUntilDate will do what you want to do. You could
also call the bsd call "sleep" directly. Type man 3 sleep for
details.
RE: how long to sleep. It very much depends on what your doing and
how fast you want to do it. I'd suggest you code it up and
experiment with values until you find a balance your happy with.
At 12:04 -0700 on 11/18/02, Buzz Andersen wrote:
>This is probably a terribly obvious rookie question, but I'll ask it
>any way. A program I am working on contains a very tight loop that
>can often run through many thousands of iterations at a time. As
>you might expect, this is having a tendency to really max out my CPU
>usage and make my computer very unresponsive.
>
>My question is: is there a good way for me to give the CPU a break
>and make the computer more responsive during this loop without
>compromising performance significantly? I have tried moving my
>thread priority down to 0.1, but that doesn't seem to make a
>difference. Would NSThread's sleepUntilDate: methods be what I'm
>looking for? If so, how long do you think I would need to sleep to
>really alleviate the problem without compromising performance too
>much? Or, alternatively, is there a better way to accomplish what
>I'm trying to do (this way seems a little hacky to me)?
--
_____________________________________________
Kevin Elliott <mailto:<email_removed>> ICQ#23758827
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
DATE : Tue Nov 19 18:33:00 2002
NSThread's sleepUntilDate will do what you want to do. You could
also call the bsd call "sleep" directly. Type man 3 sleep for
details.
RE: how long to sleep. It very much depends on what your doing and
how fast you want to do it. I'd suggest you code it up and
experiment with values until you find a balance your happy with.
At 12:04 -0700 on 11/18/02, Buzz Andersen wrote:
>This is probably a terribly obvious rookie question, but I'll ask it
>any way. A program I am working on contains a very tight loop that
>can often run through many thousands of iterations at a time. As
>you might expect, this is having a tendency to really max out my CPU
>usage and make my computer very unresponsive.
>
>My question is: is there a good way for me to give the CPU a break
>and make the computer more responsive during this loop without
>compromising performance significantly? I have tried moving my
>thread priority down to 0.1, but that doesn't seem to make a
>difference. Would NSThread's sleepUntilDate: methods be what I'm
>looking for? If so, how long do you think I would need to sleep to
>really alleviate the problem without compromising performance too
>much? Or, alternatively, is there a better way to accomplish what
>I'm trying to do (this way seems a little hacky to me)?
--
_____________________________________________
Kevin Elliott <mailto:<email_removed>> ICQ#23758827
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
| Related mails | Author | Date |
|---|---|---|
| Buzz Andersen | Nov 18, 20:04 | |
| Buzz Andersen | Nov 18, 23:09 | |
| Kevin Elliott | Nov 19, 18:33 | |
| Alex Rice | Nov 20, 02:05 | |
| Sherm Pendley | Nov 20, 05:00 | |
| Ryan Stevens | Nov 20, 16:57 | |
| Buzz Andersen | Nov 21, 05:32 | |
| Ondra Cada | Nov 21, 15:02 |






Cocoa mail archive

