Closed
Description
Two questions, following up from #49774:
- Is it safe to grab a mutex inside
_atexit()
? @kpamnany and I were worried about the system being in an undefined state during shutdown, and we aren't sure if we're allowed to grab a mutex. My hope/guess is yes it's fine? But want to confirm. - Is it possible for user tasks to still be scheduled during
_atexit()
?- If the user tasks can still be running, they might be adding new atexit_hooks while we are popping them and running them, which would be a data race.
- If that's possible, we need to
@lock atexit_hooks_lock
inside_atexit()
. - My preference would be to lock it, either way, just to be safe, assuming
1.
is resolved.