opr: Add new softsig implementation
authorSimon Wilkinson <sxw@your-file-system.com>
Fri, 23 Mar 2012 21:26:14 +0000 (21:26 +0000)
committerDaria Brashear <shadow@your-file-system.com>
Tue, 26 May 2015 18:06:18 +0000 (14:06 -0400)
commitcb0081604ef5369f34279c6eb77eb4d28406f2ac
treefd31d36a1004b30c8fb0f8e106ffcf6ad5647275
parentb8648dbefb3968329d20cad8976ce15947428678
opr: Add new softsig implementation

Signals and pthreaded applications are a poor match. OpenAFS has had
the softsig system (currently in src/util/softsig.c) in an attempt to
alleviate some of these problems. However, that implementation itself
has a number of problems. It uses signal functions that are unsafe in
pthreaded applications, and uses pthread_kill within its signal
handlers. Over the years it has been responsible for a number of
portability bugs.

The old implementation continues to receive signals in the main thread
of the application. However, the handler code is run within a seperate
signal handler thread. When the main thread receives a signal a stub
handler is invoked, which simply pthread_kill()s the signal handler
thread.

The new implementation simplifies things by only receiving signals in
the handler thread. It uses only pthread-compatible signal functions,
and invokes no code from within async signal handlers.

A complete test suite is supplied.

Change-Id: I4bac68c2f853f1e7578b54ddced3833a97dd3f82
Reviewed-on: http://gerrit.openafs.org/6947
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
src/opr/Makefile.in
src/opr/softsig.c [new file with mode: 0644]
src/opr/softsig.h [new file with mode: 0644]
tests/TESTS
tests/opr/.gitignore
tests/opr/Makefile.in
tests/opr/softsig-helper.c [new file with mode: 0644]
tests/opr/softsig-t [new file with mode: 0755]