In asset_tracker sample program, the general thread program has following structure:
static bool xyz_event_handler(const struct app_event_header *eh)
{
// subscribed events handling here
}
In asset_tracker sample program, the general thread program has following structure:
static bool xyz_event_handler(const struct app_event_header *eh)
{
// subscribed events handling here
}
Hi,
In this structure, my query is related to infinite while loop:As the thread is allotted some execution time by the scheduler of kernel, is the code inside while(1) and switch() always executed in allotted time slot to thread by the kernel or is it also related to some events internally by scheduler ?if yes, then, as system flows from state a -> b -> c, then, the code inside case c also, will be executed evertime in each thread slot as long state is c.
I'm not sure if I fully understand your question, but in the while loop there is a switch case, and depending on the current state, either a,b or c will be executed.
Hi,
In this structure, my query is related to infinite while loop:As the thread is allotted some execution time by the scheduler of kernel, is the code inside while(1) and switch() always executed in allotted time slot to thread by the kernel or is it also related to some events internally by scheduler ?if yes, then, as system flows from state a -> b -> c, then, the code inside case c also, will be executed evertime in each thread slot as long state is c.
I'm not sure if I fully understand your question, but in the while loop there is a switch case, and depending on the current state, either a,b or c will be executed.
I'm not sure if I fully understand your question
I put my query other way: let there are 4 threads.
1. How does Zephyr kernel scheduler switches to xyz thread ? normally timer slice or kernel event based ?
2. When there is turn of xyz thread, let it stays in state c. Then, will the case c be executed in every time slot of xyz thread until state is changed ?
Hi,
A message queue is being used by module_get_next_msg(). See this page: https://docs.zephyrproject.org/latest/kernel/services/data_passing/message_queues.html
Also see this post https://blog.golioth.io/zephyr-threads-work-queues-message-queues-and-how-we-use-them/
and this documentation: https://docs.zephyrproject.org/latest/kernel/services/index.html#