나는 boost :: asio :: deadline_timer를 사용하여 함수를 실행했습니다. 내부스레드 내에서 boost :: asio :: deadline_timer 사용
class MosquitoInterface{
MosquitoInterface(deadline_timer &timer) : t(timer){}
}
를 따를 때 나는 MosquitoInterface
클래스가 내 main.c
int main(int argc, char** argv)
{
io_service io;
deadline_timer t(io);
MosquitoInterface *m = new MosquitoInterface(t);
io.run();
d = new Detectdirection();
while(run)
{
int ret = d->Tracking();
if(ret < 0)
cout << "Pattern is not found" << endl ;
}
if(d!=NULL)
delete d;
if(m!=NULL)
delete m;
cout << "Process Exit" << endl;
exit(1);
}
내가 io.run()
를 실행하는 경우; while(run){ }
전까지는 while(run){ }
이 작동하지 않습니다. while(run){ }
뒤에 io.run()
을 입력하면 타이머가 작동하지 않습니다. 메인 스레드에 있기 때문에.
while 루프에 방해가되지 않도록 스레드 내에서 boost :: asio :: deadline_timer를 실행하는 방법.