Is clock_nanosleep() async-signal safe?
- From: Spoon <root@localhost>
- Date: Mon, 26 Nov 2007 10:58:34 +0100
Hello,
The Open Group Base Specifications Issue 6 states:
3.26 Async-Signal-Safe Function
A function that may be invoked, without restriction, from signal-catching functions. No function is async-signal-safe unless explicitly described as such.
The older Single UNIX Specification, Version 2 stated:
* When signal-catching functions are invoked asynchronously with process execution, the behaviour of some of the functions defined by this document is unspecified if they are called from a signal-catching function.
The following table defines a set of interfaces that are either reentrant or not interruptible by signals and are async-signal safe. Therefore applications may invoke them, without restriction, from signal-catching functions:
Base Interfaces
_exit() access() alarm() cfgetispeed() cfgetospeed() cfsetispeed() cfsetospeed() chdir() chmod() chown() close() creat() dup() dup2() execle() execve() fcntl() fork() fpathconf() fstat() fsync() getegid() geteuid() getgid() getgroups() getpgrp() getpid() getppid() getuid() kill() link() lseek() mkdir() mkfifo() open() pathconf() pause() pipe() raise() read() rename() rmdir() setgid() setpgid() setsid() setuid() sigaction() sigaddset() sigdelset() sigemptyset() sigfillset () sigismember() signal() sigpending() sigprocmask() sigsuspend() sleep() stat() sysconf() tcdrain() tcflow() tcflush() tcgetattr() tcgetpgrp() tcsendbreak() tcsetattr() tcsetpgrp() time() times() umask() uname() unlink() utime() wait() waitpid() write()
Realtime Interfaces
aio_error() clock_gettime() sigpause() timer_getoverrun()
aio_return() fdatasync() sigqueue() timer_gettime()
aio_suspend() sem_post() sigset() timer_settime()
All functions not in the above table are considered to be unsafe with respect to signals. In the presence of signals, all functions defined by this specification will behave as defined when called from or interrupted by a signal-catching function, with a single exception: when a signal interrupts an unsafe function and the signal-catching function calls an unsafe function, the behaviour is undefined.
sleep() used to be considered Async-Signal-Safe.
Is this not true anymore?
http://www.opengroup.org/onlinepubs/000095399/functions/sleep.html
(sleep is not explicitly described as Async-Signal-Safe.)
Is clock_nanosleep() also not Async-Signal-Safe?
http://www.opengroup.org/onlinepubs/009695399/functions/clock_nanosleep.html
In general, is it legal to sleep in a signal handler?
Regards.
.
- Follow-Ups:
- Re: Is clock_nanosleep() async-signal safe?
- From: Geoff Clare
- Re: Is clock_nanosleep() async-signal safe?
- Prev by Date: Re: www.freebsd.org times out
- Next by Date: new filesystem module
- Previous by thread: Whu I value doesn't change ?
- Next by thread: Re: Is clock_nanosleep() async-signal safe?
- Index(es):
Relevant Pages
|
|