Skip to content

atexit callbacks need to be threadsafe #923

@behdad

Description

@behdad

Apparently POSIX doesn't specify whether atexit callbacks are called before or after threads are terminated during process shutdown. Following suggests that in fact, they are called while threads still running!

https://stackoverflow.com/questions/39655868/what-does-the-posix-standard-say-about-thread-stacks-in-atexit-handlers-what

We should make our atexit callbacks threadsafe, simply by using cmpexch to clean things up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions