https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128197

            Bug ID: 128197
           Summary: [libstdc++] Deadlock at process exit in
                    stop_source::request_stop()
           Product: gcc
           Version: 16.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 13330742392 at wo dot cn
  Target Milestone: ---

#include <thread>

The following program hangs inside source.request_stop() and consequently never
exits:

std::jthread t([]{
    std::stop_source source;
    std::stop_token token = source.get_token();
    std::stop_callback cb(token, []{});
    source.request_stop(); // <-- blocks here, never returns
});

int main() { return 0; }

Reply via email to