I want to create a thread with ACE_thread_manager, there is no error when I debug. but the result is not right. The function did not work; code like this:
#include "ace/OS.h"
#include "ace/Log_Msg.h"
#include "ace/Thread_Manager.h"
#include <iostream>
void thread_start(void* arg)
{
std::cout << "Running thread..\n";
}
int main(int argc, char *argv[])
{
ACE_Thread_Manager::instance()->spawn(ACE_THR_FUNC(thread_start), 0, THR_NEW_LWP);
return 0;
}
this demo should print "Running thread.." , but when I debug it ,it print nothing . These Chinese mean "Please press any key to continue" .
You have to wait in your main until your workers threads have finished. As you say, you have to add the following line before the return in main.
ACE_Thread_Manager::instance()->wait();