|
#include <ace/Thread_Manager.h>
#include <ace/Get_Opt.h>
#include <ace/OS.h>
static ACE_THR_FUNC_RETURN taskone(void*)
{
ACE_DEBUG((LM_DEBUG,"Thread:(%t)started Task one! \n"));
ACE_OS::sleep(2);
ACE_DEBUG((LM_DEBUG,"Thread:(%t)finished Task one!\n"));
return 0;
}
static ACE_THR_FUNC_RETURN tasktwo(void*)
{
ACE_DEBUG((LM_DEBUG,"Thread:(%t)started Task two!\n"));
ACE_OS::sleep(1);
ACE_DEBUG((LM_DEBUG,"Thread:(%t)finished Task two!\n"));
return 0;
}
int wmain()
{
ACE_Thread_Manager::instance()->spawn(taskone,0);
ACE_Thread_Manager::instance()->spawn(tasktwo,0);
ACE_OS::sleep(10);//加上这句话之后程序就会崩溃
return 0;
}
ACE_OS::sleep(10);//加上这句话之后程序就会崩溃
在这里用getchar 或者ACE_Thread_Manager::instance()->join也会引起程序崩溃?
我是ace初学者,请教各位大侠这是怎么回事??? |
|