Hi everyone, happy new year!I have a RTX V5 thread flag related issue:In my program, TaskA needs to wake up TaskB frequently under certain circumstances. TaskB is a low-speed device (LED blinks). In this case, what adverse effects does TaskA frequently call osThreadFlagsSet?I always feel that this is not very good. Is there any good way for you to "synchronize low speed threads with high speed threads"? Thank you !
Code show as below:
Note: TaskA has higher priority than TaskB.
void TaskA (void *argument) { static uint32_t flags; while(1) { // Alarm generated every 10ms flags = osThreadFlagsSet(ThreadIdTaskB, 1); osDelay(10); } } void TaskB (void *argument) { static uint32_t flags; while(1) { flags = osThreadFlagsWait(1, osFlagsWaitAny, osWaitForever); LED(1); osDelay(500); LED(0); osDelay(500); } }
iwant said:In my program, TaskA needs to wake up TaskB frequently under certain circumstances. TaskB is a low-speed device (LED blinks). In this case, what adverse effects does TaskA frequently call osThreadFlagsSet?
I don't see that question as making much sense. For starters, the distinction of these tasks as being "slow" vs. "fast" is incorrect. Tasks can have high vs. low priority, or they can have short or long times for completing, once activated.
As to the question itself, there is no "synchronization" of tasks going on here, either. There's just passing of events. And without a quantification of what "frequently" actually means, there's no way to say if there would be any adverse effects at all.
Thank you for your reply, I have refreshed my question!