Struct bagpipe::BagPipe [] [src]

pub struct BagPipe<B: SharedWeakBag> { /* fields omitted */ }

A concurrent bag data-structure built from sharding requests over other bags.

BagPipe implements both SharedWeakBag and WeakBag. Using this as a SharedWeakBag tends to perform worse. Note that this should never be used with Arc<BagPipe>, which will be much slower and have an increased failure rate.

Methods

impl<B: SharedWeakBag> BagPipe<B>
[src]

[src]

Create a new BagPipe with size pipes.

[src]

Return a guess of the current BagPipe size.

This is implemented in a way that seeks to reduce overhead as much as possible. Currently there are 4 AtomicIsize counters in the global BagPipeState struct; one of these is updated when a thread accumulates a local diff (i.e. net pushes or pops) greater than a certain small constant. A thread querying the size of the BagPipe then simply sums these counters.

Given this algorithm there are no consistency guarantees on this counter, not even eventual consistency. A counter is updated upon drop, so one "consistency guarantee" is that of a very weak quiescent consistency when "quiesce" means all threads that have pushed or popped from the data-structure have relinquished a handle on it. Note that this term usually refers to a sufficiently long period of inactivity.

impl<B: RevocableWeakBag> BagPipe<B> where
    B::Item: Revocable
[src]

[src]

Attempt to revoke it from membership in the BagPipe.

This is simply an implementation of portions of the Revocable trait for a BagPipe. We don't implement the trait here because it inherits from SharedWeakBag and BagPipes have unexpected behavior when used without the _mut() methods. This problem could be solved if we had "or" trait inheritance, but that could be more trouble than its worth :-)

Trait Implementations

impl<B: SharedWeakBag> Drop for BagPipe<B>
[src]

[src]

Executes the destructor for this type. Read more

impl<B: SharedWeakBag> Clone for BagPipe<B>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<B: SharedWeakBag> WeakBag for BagPipe<B>
[src]

[src]

[src]

[src]

[src]

[src]

Add all items in I to the WeakBag. Read more

[src]