Skip to content

Instantly share code, notes, and snippets.

@matthewfl
Created August 29, 2014 02:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewfl/7a26b5595bcfe2e50d1e to your computer and use it in GitHub Desktop.
Save matthewfl/7a26b5595bcfe2e50d1e to your computer and use it in GitHub Desktop.
// compile with: g++ -lboost_thread -lboost_system -ggdb -O0 -std=c++1y gdb_bug.cc
#include <boost/thread.hpp>
#include <iostream>
using namespace std;
using namespace boost;
static void thread_start(void *data) {
cout << "hello world\n" << flush;
}
int main () {
cout << "before\n" << flush;
boost::thread th(thread_start, (void*)0);
cout << "1" << flush;
th.detach();
cout << "2" << flush;
for(int a =0; a < 1000000; a++);
cout << "3" << flush;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment