Why do threads start execution from _Thread_Handler?

Richi Dubey richidubey at gmail.com
Mon Jan 4 17:52:26 UTC 2021


I am debugging a code (tm24
<https://git.rtems.org/rtems/tree/testsuites/tmtests/tm24/task1.c>) and
there is a scenario where a thread is blocked on the CPU and a new thread
has to start executing in its place. So, the thread which is getting
blocked (executing thread) executes the _Thread_Do_dispatch and runs the
code until
_Context_Switch( &executing->Registers, &heir->Registers ). After this, the
heir thread starts executing from _Thread_Handler. Why is this the case?
Should the heir not start its execution from where the (earlier) executing
thread left the program counter at, i.e. after the _Context_Switch in

Please let me know your thoughts.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20210104/967b800f/attachment.html>

More information about the devel mailing list