This function and the reaper() function itself are provided.
In implementing the user level thread library, you are responsible for cleaning up a thread: deallocating its stack and so on.
When does this occur? What thread does it? (It has to be a user level thread; it isn't handled by the kernel.)
- A thread can call uthread_join(uid,&val) if the thread uid is not detached. And this function can clean up thread uid.
- If a thread IS detached, then the thread should be cleaned up
when it terminates. Since that thread is executing when it
terminates, it seems the thread should clean up itself.
But this is a problem since that means delete its own stack while it is using its own stack.
This is were the reaper() function plays a role. A reaper thread (with reaper() as its start function) is to clean up detached threads.