Atomicity of signal handlers

Mirko Zeibig mirko-lists at zeibig.net
Thu Aug 7 05:38:28 EDT 2003


On Thu, 07 Aug 2003 at 08:29 GMT, Mirko Zeibig <mirko-lists at zeibig.net> wrote:
> assuming I have a C++-library implementing tracing, where the tracefile is
> implemented as singleton and implements a method rotateLogs.
> 
> Is it safe to have something like:
> 
> def handleSIGUSR2(signal, frame):
>     tracelib.rotateLogs()
> 
> signal.signal(signal.SIGUSR2, handleSIGUSR2)

Pardon, for following up to myself, to clarify this a bit:

- given the mechanism above, what would happen if I had:

1: do_sth()
2: tracelib.log("A")
3: do_sth_else()
...

where tracelib.log would be a call into the C++-Library.

- now, if SIGUSR2 is received by the process, will tracelib.log be interrupted
  or will the signal be deferred until tracelib.log returns?

Regards
Mirko




More information about the Python-list mailing list