This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RTX kernel doubt.........

In my RTX kernel task management system
the function os_dly_wait(); is not working properly .My need is to generate a delay in one task and then such over to another,that i have two task task1 and task2 . I use the above function .But its not working properly.I dont know its my fault or not.Anyone please help me as early as possible.

Parents
  • Sir,

    Thank you for your reply .... please give me a sample program which shows the function os_dly_wait()

    I have two tasks t1, t2.in each task their is a print statement. my need is to generate a delay in the first task and then go to the second(t2)...ie communication from t1 to t2 only after that delay.Is this possible through os_dly_wait().

Reply
  • Sir,

    Thank you for your reply .... please give me a sample program which shows the function os_dly_wait()

    I have two tasks t1, t2.in each task their is a print statement. my need is to generate a delay in the first task and then go to the second(t2)...ie communication from t1 to t2 only after that delay.Is this possible through os_dly_wait().

Children
  • You want task 1 to make a delay.

    You want task 2 to wait until task 1 have finished it's delay.

    Any special reason? Use of multiple tasks are normally to allow several things to happen semi-concurrently, or to simplify code loops - for example when implementing producers-consumers or similar. In this case, you want both tasks to sleep - is that because of an external requirement?

  • 
    u32 task1_id;
    u32 task2_id;
    
    #define EVENT_ID (1)
    
    void task1()
    {
        print();
        os_dly_wait(500);
        os_set_evt(EVENT_ID, task2_id);  // this will cause task 2 to become READY to run. you may want to delay again.
        ......
    }
    
    void task2()
    {
        os_evt_wait(EVENT_ID,0xFFFF,FALSE);
        // any code here will be after task1's os_set_evt
    }
    
    void master_task()
    {
      task1_id = os_tsk_create(task1,100);
      task2_id = os_tsk_create(task2,100);
    
      os_dly_wait(0xFFFF); // put this task to sleep
    }
    
    int main()
    {
        os_sys_init(master_task);
    }