Re: [Quickfix-developers] ctrl-c , sleep and a clean shutdown
Brought to you by:
orenmnero
From: Oren M. <or...@qu...> - 2004-06-05 01:16:08
|
It wouldn't. The reason this was done is because it turns out doing=20 handling this in a portable way (i.e. works in unix and windows), turns=20= out to be not trivial. I didn't want to clutter up the sample code=20 with that sort of nonsense so I just took the easy way out. You are=20 correct in noting that this will not do a clean exit, and will in fact=20= result in a SIG_INT which terminates the application. If you look at=20 the java example, you will see that it waits for a keypress and then=20 does do a proper exit. If you want to do a clean exit on Ctrl-C, you=20 will have to set up a signal handler for your application. --oren On Jun 4, 2004, at 8:06 PM, Clark Sims wrote: > In the file executor.cpp I see the following code: > =A0 > > void wait() > { > =A0 std::cout << "Type Ctrl-C to quit" << std::endl; > =A0 while(true) > =A0 { > =A0=A0=A0 FIX::process_sleep(1); > =A0 } > } > > and this is called from > > =A0 > > > =A0=A0=A0 acceptor.start(); > =A0=A0=A0 wait(); > =A0=A0=A0 acceptor.stop(); > =A0=A0=A0 return 0; > > =A0 > > acceptor.stop(), must be the function that cleans up before a = shutdown. > > =A0 > > I don't understand how ctrl-c causes wait to return. I went through=20 > the code for process_sleep, and no call to signal, is made. Nor is=20 > there a call to signal anywhere else. It looks to me that typing=20 > ctrl-c would cause the program to shutdown immediately, and that=20 > acceptor.stop, would never be called. > > =A0 > > So my question is, how can ctrl-c cause this program to shutdown in a=20= > clean way? > > =A0 > > Thanks in Advance, > > =A0 > > Clark Sims > > Do you Yahoo!? > Friends. Fun. Try the all-new Yahoo! Messenger= |