[Oval-devel] CTRL+C handling in server

Pavel Vinogradov Pavel.Vinogradov at nixdev.net
Wed Oct 17 09:18:09 UTC 2007


2007/10/17, Javier Fernandez-Sanguino <jfs at computer.org>:
>
> > 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)

  Basic threading module don't provide this functionality. In discussions i
see references to Java threads implementation (base for python threading
model), and many people point that stop() method in threading API is
deprecated (by thread security reason).

> 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?

  Right, but timeout very small. Simply i don't like rewrite methods of
parent HttpServer class to correct support this timeouts. I prefer put this
in TODO for future, maybe it will more elegant solution.

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

   No, Ctrl+C is equivalent to SIGINT. I will try to sent SIGHUP signal in
Ctrl+C handler and see results.

-- 
Pavel Vinogradov
NixDev.Net, Linux Developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/oval-devel/attachments/20071017/0ace4801/attachment.htm 


More information about the Oval-devel mailing list