pub struct TChan<T> { /* private fields */ }Expand description
Ubounded queue using a linked list of TVars.
This implementation builds up a linked list of TVars with a
read and a write pointer. The good thing is that the reads don’t
cause retries in writes, unlike if it was just a single TVar
with one data structure in it. It may also help that it’s more
granular, and Transaction::downcast will not clone a full
data structure.
Implementations§
Trait Implementations§
source§impl<T> TQueueLike<T> for TChan<T>where
T: Any + Sync + Send + Clone,
impl<T> TQueueLike<T> for TChan<T>where T: Any + Sync + Send + Clone,
source§fn read(&self) -> StmResult<T>
fn read(&self) -> StmResult<T>
Pop the head of the queue, or retry until there is an element if it’s empty.
Moves the read TVar down the list to point at the next item.
[TCons(x, [TCons(y, [TNil])])]
| | |
[ ] [*] [*]
read0 -> read1 write