If this is for a pico then it has its own timers (the pico forum). Otherwise we'd need to know more about your program. Is it a GUI program? Is it a console program?
I think you misunderstand threads. They exist to do exactly this. Your "main" carries on running but it spawns a thread which goes to sleep. If you send the thread to sleep in the correct way it won't consume any resources until the condition is it waiting for occurs, at which point the OS will wake the thread up.
Perhaps it will help if you post (or link) to a short example of what you think is a problem bit of code so we can get an idea.
I think you misunderstand threads. They exist to do exactly this. Your "main" carries on running but it spawns a thread which goes to sleep. If you send the thread to sleep in the correct way it won't consume any resources until the condition is it waiting for occurs, at which point the OS will wake the thread up.
Perhaps it will help if you post (or link) to a short example of what you think is a problem bit of code so we can get an idea.
Statistics: Posted by swampdog — Fri Dec 06, 2024 12:00 am