Re: Multitasking in Mac OS Gets 100% CPU
- Posted by bryanso Nov 05, 2012
- 1551 views
Hi Matt, thanks for the suggestion. It's a command shell so it's waiting for user to run something in the background, e.g. in Unix shell, one can put an & at the end of a command to run it in the background.
Ideally the input routine doesn't need to be written in two ways: wait_key when nothing is running in background; switch to get_key when there is a background job, and somehow switch back to wait_key when the background jobs complete. That's very complicated.
Again, I'll post a streamlined test case later, which will make it clear.
Hi Ryan, I think I can't use task_delay(5) in a loop that's getting user input. The user will feel the keyboard is sluggish.
If you're not really doing anything else, and this is a console program, then you should probably be using wait_key().
Matt