I am seeing an issue on program that is running on embedded board on VxWorks platform.
Problem description: A user space Task A with priority of 150 -> adds the TaskSwitchHookAdd((FUNCPTR) monitor_TaskA) to validate object states within TaskA via Semaphore resource. I was using sem_Give() in monitor_TaskA() function and a function validate_TaskA_obj_states() that is present in Task A that runs in an infinite while(1) loop waiting on sem_Take() forever and does perform a custom operation on it. However, upon executing this piece of code, I never saw the code was executed in validate_TaskA_obj_states() however crashing my actual application on VxWorks board. If I want to monitor Task A internal object states via -> validate_TaskA_obj_states() to the micros second granularity, what is the best approach in this context. Why this function is crashing on the board, no specific error message looks like may be a potential deadlock situation. With an empty monitor_TaskA() function without any code in it (no Sem_Give()), I was able to see the application do not crash. But, however, why sem_Give() and sem_Take() in different routines have not worked with TaskSwitchHookAdd function excution.
Let me know if you have any better options for performing the same task via task library. If possible, add the pseudo code or reference code to the same.
Thank you.
I have tried the approaches as specified in the problem description.