Let's say I:
malloc
apthread_t
for holding a thread contextpthread_create
with as user parameter the pointer to thepthread_t
structure
In other words, the thread function has access to its pthread_t
context structure. Now here is the tricky bit:
How can the pthread exit on its own and get the pthread_t
context freed somehow? i.e. is it possible not to involve the parent thread? (no mutex/join etc.)
Think of this as a "lightweight process".
(and no the thread cannot free()
the structure just before exiting its thread_func
.