ForgeDocs
Documentation for the forge framework
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
Forge.Collections.ConcurrentWriterBag< T > Class Template Reference

Provides a queue where pushing is assumed to be done concurrently, but reading is done in a single-thread where no writing is done. More...

Inheritance diagram for Forge.Collections.ConcurrentWriterBag< T >:

Public Member Functions

 ConcurrentWriterBag ()
 Construct a new concurrent writer bag. More...
 
void Add (T item)
 Adds the item in the collection. More...
 
List< T > ToList ()
 Returns all items inside of the bag as a list. This method is not thread safe. This method does not clear the collection. More...
 
void IterateAndClear (Action< T > iterator)
 Calls the iterator over every item in the bag and then clears the bags that were iterated. More...
 
void Dispose ()
 

Detailed Description

Provides a queue where pushing is assumed to be done concurrently, but reading is done in a single-thread where no writing is done.

Template Parameters
TThe type of object stored.

Constructor & Destructor Documentation

Forge.Collections.ConcurrentWriterBag< T >.ConcurrentWriterBag ( )

Construct a new concurrent writer bag.

Member Function Documentation

void Forge.Collections.ConcurrentWriterBag< T >.Add ( item)

Adds the item in the collection.

This is a thread-safe function.

Parameters
itemThe item to enqueue
void Forge.Collections.ConcurrentWriterBag< T >.IterateAndClear ( Action< T >  iterator)

Calls the iterator over every item in the bag and then clears the bags that were iterated.

This method is NOT thread-safe; do NOT call Add while iterating the items.

Parameters
iteratorThe function to invoke on the items.
List<T> Forge.Collections.ConcurrentWriterBag< T >.ToList ( )

Returns all items inside of the bag as a list. This method is not thread safe. This method does not clear the collection.


The documentation for this class was generated from the following file: