What is the best way to identify that a function returned and automatically do something with it?

Posted by EpsilonVector on Stack Overflow See other posts from Stack Overflow or by EpsilonVector
Published on 2010-05-18T16:16:45Z Indexed on 2010/05/18 16:21 UTC
Read the original article Hit count: 137

Filed under:
|
|

I'm implementing user threads on a Linux 2.4 kernel (homework) and my threads are basically just functions running with their own execution context (for example: uthread_create(functionpointer, args)). I'm having a hard time figuring out how to catch the return value and have it ready to be returned when two threads join.

I know where to get the value from (eax), but not how to identify that the function actually finished. There's something called atexit, but I've seen people advising against using it, so... what is the best way to discover that a function returned and do something about it?

© Stack Overflow or respective owner

Related posts about threads

Related posts about functions