[Oval-devel] CTRL+C handling in server

Javier Fernandez-Sanguino jfs at computer.org
Wed Oct 17 08:08:06 UTC 2007


2007/10/17, Pavel Vinogradov <Pavel.Vinogradov at nixdev.net>:
>   During last weekend i was work on bug about stopping oval-server on
> keyboard interrupt from console (aka CTRL+C bug).

Yes, I've seen your commits.

>   Reading google and some experiments give me three version of stopping http
> thread:
> 1. mainThread on KeyboardException send yourself HUP or KILL signal and this
> signal kills all thread.

I'm not sure but, can't the parent send sighups to all threads? (this
is what is commonly done in processes spawned by servers, but I don't
know if this is possible with threads)

> 2. Use sockets timeouts. With timeouts accept call was interrupted after
> some time. But in this case i must rewrite some methods of parent HttpServer
> class.

However, this has the problem that the interrupt is not inmediate, right?

> 3. Emulate client connection to httpThread from mainThread.

I wouldn't implement this, too much overhead.

I think the simplest would be #1. After all, a Ctrl+C is equivalent to
a SIGKILL sent from the console, right?

Regards

Javier



More information about the Oval-devel mailing list