We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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.
In what way is it not working properly?
If you call os_dly_wait(1..0xFFFF) and there is a task Ready to run, the highest priority task Ready to run WILL run. If not tasks are Ready, then the task that called os_dly_wait() will become ready to run in the number of timer ticks that you passed in and if it is the only task Ready to run, it will then run.
If that is not happening, then you do have something wrong. I beleive even if you timer is not running it will do this (but the delayed task will NEVER become un-delayed)
You also have to have initialized the OS. os_init_task(...)
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().
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); }