This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Is async-signal-safety applicable to Cygwin?


On 3/19/19 9:28 AM, LRN wrote:
> ASS[0] is documented for Linux (and for POSIX) but i'm failing to find any
> information on how this applies to Cygwin. I assume, since there are no "real"
> signals on Cygwin, that it's not possible for a signal handler to break the
> state of some function that happened to be executed when the signal handler was
> triggered. But i could be wrong.

You are wrong. It IS applicable. Cygwin has signals and signal handlers;
although Windows may not have POSIX signals as such, it DOES have the
ability to interrupt a process mid-function when a timer expires, and
cygwin's implementation of signals on top of the semantics that windows
provides can indeed result in interrupting the middle of a
non-async-safe function.  Hence, a signal handler that calls a
non-async-safe function at the same time that the signal has interrupted
another non-async-safe function is indeed observable on Cygwin and can
indeed result in deadlocks (a classic example being the case if you
malloc() from a signal handler that interrupted an ongoing malloc() call).

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]