Struct reopen::Handle [−][src]
pub struct Handle(_);
A handle to signal a companion Reopen
object to do a reopen on its next
operation.
Methods
impl Handle
[src]
impl Handle
pub fn register_signal(&self, signal: c_int) -> Result<(), Error>
[src]
pub fn register_signal(&self, signal: c_int) -> Result<(), Error>
Installs a signal handler to invoke the reopening when a certain signal comes.
Notes
- This installs a signal handler. Signal handlers are program-global entities, so you may be careful.
- If there are multiple handles for the same signal, they share their signal handler ‒ only the first one for each signal registers one.
- Upon signal registration, the original handler is stored and called in chain from our own signal handler.
- A single handle can be used for multiple signals.
- It is not (currently) possible to unregister a handle once it's been registered. While an orphaned handle (one whose Reopen was dropped) doesn't do any harm, it still takes some space in memory. Therefore registering and forgetting handles in a loop might not be a good idea.
Race condition
Currently, there's a short race condition. If there was a previous signal handler and a signal comes into a different thread during the process of installing our own, it may happen neither ours nor the original is called. The practical effect of this is considered rather unimportant, as most programs install their signal handlers early at startup, before they have chance to do anything useful. Still, if there are ideas how to avoid that, they are welcome.
Note that installing the signal handler before starting any threads eliminates the race condition.
Error handling
Note that if this function returns an error, there's no guarantee about what signal handlers were or were not set up or if the handle is registered for signal handling.
impl Handle
[src]
impl Handle
pub fn reopen(&self)
[src]
pub fn reopen(&self)
Signals the companion Reopen
object to do a reopen on its next
operation.
pub fn stub() -> Self
[src]
pub fn stub() -> Self
Creates a useless handle, not paired to anything.
Note that this useless handle can be added to a new Reopen
with the
with_handle
and becomes useful.
Trait Implementations
impl Clone for Handle
[src]
impl Clone for Handle
fn clone(&self) -> Handle
[src]
fn clone(&self) -> Handle
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Handle
[src]
impl Debug for Handle