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.
Hi, i am new to real-time systems and rtx. my doubt is i have written a program in which i am creating two tasks one with while loop(task1) and one doesn't have while loop(task2),both with same priority.
my doubt here is when i execute my program when task1 is executing it executes for round robin timeout duration and gives chance to task2 which doesn't have while loop task2 executes once and continues to be in RUNNING state and task1 starts to execute in task2 stack and puts it in delay whereas i should not be put actually.
the code is as follows:
#include <RTL.h> OS_TID tid; __task void task3(void) { tid = os_tsk_self(); } __task void task2(void) { while(1) os_dly_wait(10); } __task void task1(void) { os_tsk_create(task2 , 0x01); os_tsk_create(task3 , 0x01); os_tsk_delete_self(); } int main() { os_sys_init(task1); }
It is the case that you get undefined behaviour if you run out of a task function, since Keil only documents that a function may not do that but doesn't document what failure you will get.
In your case, it's enough to know that your code isn't fulfilling the requirements - so either add a loop or have the thread kill itself.