timely-communication-master 0.13.0-dev.1

Communication layer for timely dataflow
Documentation
//! A type that can unpark specific threads.

use std::thread::Thread;

/// Can unpark a specific thread.
#[derive(Clone)]
pub struct Buzzer {
    thread: Thread,
}

impl Buzzer {
    /// Creates a new buzzer for the current thread.
    pub fn new() -> Self {
        Self {
            thread: std::thread::current()
        }
    }
    /// Unparks the target thread.
    pub fn buzz(&self) {
        self.thread.unpark()
    }
}