Feature #2007
Provide a mechanism for waiting until a termination request (e.g. SIGINT) arrives
Status: | Resolved | Start date: | 09/16/2014 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | J. Moringen | % Done: | 100% | |
Category: | Operating System Abstraction | |||
Target version: | Robotics Service Bus - rsb-0.11 |
Description
Interface
void initSignalWaiter(int signals) Signal waitForSignal()Implementation
- Linux: signal handler and pthread semaphore
- MacOS: similar
- Win32: ?
Related issues
Associated revisions
Interface for waiting on termination signals in src/rsc/misc/SignalWaiter.h
refs #2007
- src/rsc/misc/SignalWaiter.h: new file; contains interface for waiting
on termination signals - examples/SignalWaiter.cpp: new file; example demonstrating the new
interface
Reviewed-by: Johannes Wienke <jwienke@techfak.uni-bielefeld.de>
POSIX implementation of termination signal waiting in src/rsc/misc/PosixSignalWaiter.cpp
refs #2007
- src/rsc/misc/POSIXSignalWaiter.cpp: new file; contains POSIX
implementation of the termination signal waiting interface - src/CMakeLists.txt: added file src/rsc/misc/POSIXSignalWaiter.cpp
Reviewed-by: Johannes Wienke <jwienke@techfak.uni-bielefeld.de>
Win32 implementation of termination signal waiting in src/rsc/misc/Win32SignalWaiter.cpp
refs #2007
- src/rsc/misc/Win32SignalWaiter.cpp: new file; contains implementation
stub for Win32 of the termination signal waiting interface - src/CMakeLists.txt: added file src/rsc/misc/Win32SignalWaiter.cpp
Added Mac implementation for signal waiting
fixes #2007
- src/rsc/misc/MacSignalWaiter.cpp: new file with new implementation
- src/CMakeLists.txt: added a complete new branch to select mac
implementations
Reviewed-by: Jan Moringen <jmoringe@techfak.uni-bielefeld.de>
Enforce order of initSignalWaiter, waitForSignal calls in src/rsc/misc/*SignalWaiter.cpp
refs #2007
- src/rsc/misc/PosixSignalWaiter.cpp (requestedSignals): new variable;
stores requested signals
(initSignalWaiter): store requested signals in requestedSignals
(waitForSignal): check requestedSignals and throw an exception if it
has not been set - src/rsc/misc/MacSignalWaiter.cpp: similar
- src/rsc/misc/Win32SignalWaiter.cpp: similar
Added hasSignalArrived in src/rsc/misc/SignalWaiter.h
refs #2007
- src/rsc/misc/SignalWaiter.h (hasSignalArrived): new function; return
true if one of the requested signals has arrived - src/rsc/misc/PosixSignalWaiter.cpp (receivedSignal): initialize to 0
(hasSignalArrived): new function; check receivedSignal variable to
determine return value - src/rsc/misc/MacSignalWaiter.cpp: similar
- src/rsc/misc/Win32SignalWaiter.cpp (receivedSignal): new function;
stub
History
#1 Updated by J. Moringen over 9 years ago
- Assignee changed from J. Moringen to J. Wienke
Please add the MacOS implementation :)
#2 Updated by J. Moringen over 9 years ago
- File sem.c added
- % Done changed from 40 to 60
The existing code is in the feature-2007
branch.
Our MacOS experiments are in the attached file.
#3 Updated by J. Moringen over 9 years ago
- Blocks Bug #2008: Clean up and exit properly when receiving SIG{INT,TERM} added
#4 Updated by J. Wienke over 9 years ago
- Assignee changed from J. Wienke to J. Moringen
- % Done changed from 60 to 80
I pushed a quick implementation. Could you please review it, especially the CMake changes.
Windows (non-support) is still missing.
#5 Updated by J. Moringen over 9 years ago
- % Done changed from 80 to 90
I force-pushed some very minor modifications. Since the merge simulator jobs broke, i cannot check whether everything still builds.
Apart from that, we an probably add this to master tomorrow.
#6 Updated by J. Wienke over 9 years ago
- Status changed from In Progress to Resolved
- % Done changed from 90 to 100
Applied in changeset rsc|9d0ab62812c0dd820ce903275aebe21773563a09.
#7 Updated by J. Moringen over 9 years ago
- Related to Tasks #2011: Update examples and documentation to use rsc::misc::{waitForSignal,lastArrivedSignal} added