Struct triple_buffer::Input [−][src]
pub struct Input<T: Send> { /* fields omitted */ }
Producer interface to the triple buffer
The producer of data can use this struct to submit updates to the triple buffer whenever he likes. These updates are nonblocking: a collision between the producer and the consumer will result in cache contention, but deadlocks and scheduling-induced slowdowns cannot happen.
Methods
impl<T: Send> Input<T>[src]
impl<T: Send> Input<T>pub fn write(&mut self, value: T)[src]
pub fn write(&mut self, value: T)Write a new value into the triple buffer
pub fn consumed(&self) -> bool[src]
pub fn consumed(&self) -> boolCheck if the consumer has fetched our last submission yet
This method is only intended for diagnostics purposes. Please do not let it inform your decision of sending or not sending a value, as that would effectively be building a very poor spinlock-based double buffer implementation. If what you truly need is a double buffer, build yourself a proper blocking one instead of wasting CPU time.