Block task waiting for flag change

znatok wrote on Sunday, December 02, 2012:

> You can assign a function to every task. See http://www.freertos.org/xTaskGetApplicationTaskTag.html.
Not sure how tags should help me.

OK. I get your point. Scheduler is no going over task list deciding which task to run but instead it takes next task from ready to run list. So actually I need to prevent task from being putted into ready list. In my case event that will put my task into ready list is timer tick. So I need a hook to timer tick processing just before kernel decides to put task into ready list.  Ideally  would be something like this:

int hook()
{
  if( flag $ bit )
      return 0;  /* OK to run task */
  else
     return SOME_TIME_TO_CONTINUE_WAIT;
}

task()
{
   set_hook ( hook );
   while(1)
   {
       vTaskDelay( SOME_TIME )

       /* Process Event */
    }

After SOME_TIME has passed tick handler will attempt to put task into running list and here it should ask hook if it should be done or not. If hook return 0 task will be placed into run list. Otherwise task should delay more SOME_TIME_TO_CONTINUE_WAIT ticks.