Strange behavior of functions be called after task switching

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
mrjbom
Member
Member
Posts: 317
Joined: Sun Jul 21, 2019 7:34 am

Strange behavior of functions be called after task switching

Post by mrjbom »

Hi.
I rewrite the code of my task switcher for the hundredth time and now it seems to work correctly.
However, I get a strange error related to calling a function rather than switching tasks.

So, in order for threads running at the kernel level to safely use "return", the first time I call them with the help of "call".
Immediately after calling the thread function, I make a call to the function that completes execution as soon as the thread terminates.
However, here I have problems. This function prints nonsense(data about the first thread is correct, data about the second thread is incorrect, and there should not be a third thread)
For the test I tried calling this function 3 times here and everything prints fine.

It turns out that if I call a function that prints data from another function, I run into problems.
Why is she acting like this?
Post Reply