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]

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]

Signals the companion Reopen object to do a reopen on its next operation.

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]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Handle
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for Handle

impl Sync for Handle