Skip to contentSkip to conversation

Question about CLONE_CLEARTID and thread group leader

DISCUSSION Jamie Lokier 2 participants 2 messages Sep 17, 2002

lore
Share & tools
lore
#0 lore raw

Dear Ingo,

CLONE_CLEARTID was created so that a thread can notify its partner threads that its stack may by freed or reused. It is needed because the stack isn't free until the exit() system call begins.

One question has been bothering me for a while: what about the thread group leader's stack? These days, isn't it the case that the group leader is supposed to be equivalent to the other threads? If so, how does it exit and release its own stack -- or do we understand that the group leader, as a one-off exception, has to block signals before exiting?

Thanks,
-- Jamie

#1 lore raw
Quoted 6 lines · Jamie Lokier

One question has been bothering me for a while: what about the thread group leader's stack? These days, isn't it the case that the group leader is supposed to be equivalent to the other threads? If so, how does it exit and release its own stack -- or do we understand that the group leader, as a one-off exception, has to block signals before exiting?

good question. We might need a new mechanism (new syscall) for a thread to set its own ->user_tid after it has started up. I'll code it up. The fastest thread-startup method is still to also have this mechanism provided by clone() as well - but oviously at exec() time we cannot know about such issues.

Ingo