[][src]Macro juggle::yield_while

macro_rules! yield_while {
    ($test_expr:expr) => { ... };
}

Yield current task until specific expression becomes false. Gives the scheduler opportunity to switch to another task.

It is recommended to use this function instead of busy wait inside tasks within scheduler.

Examples

 async fn timer_task(){
     init_external_timer();
     yield_while!(get_timer_value() < 10);
     do_some_work();
     shutdown_external_timer();
 }