When mainthe call completes, it calls exitwhich terminates all threads, regardless of whether it is disconnected or not. This is because it exitcompletes the whole process.
The C ++ runtime runs mainas exit(main(argc, argv)), so returning from maina call exit.
, , pthread_exit. main exit. , - exit ( ). Linux, Windows.
std::cout, , exit. Schwarz Counter, , , . , , , main ( exit), - . , , , ( ) .
ISO/IEC 14882: 2011 (E) :
27.4 iostream
27.4.1.2 [ ] , ios_base::Init main †. . ios_base::Init . , ios_base::Init .
† stdin stdout stderr.