Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Result of not joining thread in main()
#include <chrono> #include <iostream> #include <thread> class active_object { public: active_object() : m_thread(&active_object::thread_body, this) {} private: void thread_body() { std::cout << "Thread body just started" << std::endl; std::this_thread::sleep_for(std::chrono::milliseconds(200)); std::cout << "Thread body about to end" << std::endl; } std::thread m_thread; }; int main() { std::cout << "Started main, starting worker" << std::endl; active_object runner; std::cout << "Started worker" << std::endl; std::this_thread::sleep_for(std::chrono::milliseconds(100)); return 0; }
run
|
edit
|
history
|
help
0
Uno v2
Test3
C++ Standard Template Library
auto Keyword Example
Enum flags operator example
back_inserter example
INHERIT_CTORS default constructor
C++17 function traits not works
hw 1 os
HerbSutter-Virtuality