![]() |
TrinityCore
|
#include <ThreadSet.h>
Public Types | |
| typedef GThread | Thread |
| typedef shared_ptr< Thread > | ThreadRef |
| typedef shared_ptr< ThreadSet > | Ref |
| typedef Array< ThreadRef > ::Iterator | Iterator |
| typedef Array< ThreadRef > ::ConstIterator | ConstIterator |
Public Member Functions | |
| int | size () const |
| int | numStarted () const |
| void | start (SpawnBehavior lastThreadBehavior=USE_NEW_THREAD) const |
| void | terminate () const |
| void | waitForCompletion () const |
| void | clear () |
| int | removeCompleted () |
| int | insert (const ThreadRef &t) |
| bool | remove (const ThreadRef &t) |
| bool | contains (const ThreadRef &t) const |
| Iterator | begin () |
| Iterator | end () |
| ConstIterator | begin () const |
| ConstIterator | end () const |
Public Member Functions inherited from G3D::ReferenceCountedObject | |
| virtual | ~ReferenceCountedObject () |
Private Attributes | |
| GMutex | m_lock |
| Array< ThreadRef > | m_thread |
Manages a set of threads. All methods are threadsafe except for the iterator begin/end.
| typedef Array<ThreadRef>::Iterator G3D::ThreadSet::Iterator |
| typedef shared_ptr<ThreadSet> G3D::ThreadSet::Ref |
| typedef GThread G3D::ThreadSet::Thread |
Intended to allow future use with a template parameter.
| typedef shared_ptr<Thread> G3D::ThreadSet::ThreadRef |
| ThreadSet::Iterator G3D::ThreadSet::begin | ( | ) |
It is an error to mutate the ThreadSet while iterating through it.
Here is the call graph for this function:| ThreadSet::ConstIterator G3D::ThreadSet::begin | ( | ) | const |
Here is the call graph for this function:| void G3D::ThreadSet::clear | ( | ) |
Remove all (not stopping them)
Here is the call graph for this function:
Here is the call graph for this function:| ThreadSet::Iterator G3D::ThreadSet::end | ( | ) |
Here is the call graph for this function:| ThreadSet::ConstIterator G3D::ThreadSet::end | ( | ) | const |
Here is the call graph for this function:Inserts a new thread, if it is not already present, and returns the new number of threads.
Here is the call graph for this function:
Here is the caller graph for this function:| int G3D::ThreadSet::numStarted | ( | ) | const |
Number of threads that have been started
Here is the call graph for this function:Removes a thread. Returns true if the thread was present and removed.
Here is the call graph for this function:| int G3D::ThreadSet::removeCompleted | ( | ) |
Removes completed threads and returns the new size.
Here is the call graph for this function:| int G3D::ThreadSet::size | ( | ) | const |
Total number of threads (some of which may be completed).
Here is the call graph for this function:| void G3D::ThreadSet::start | ( | SpawnBehavior | lastThreadBehavior = USE_NEW_THREAD | ) | const |
Start all threads that are not currently started.
| lastThreadBehavior | If USE_CURRENT_THREAD, takes the last unstarted thread and executes it manually on the current thread. This helps to take full advantage of the machine when running a large number of jobs and avoids the overhead of a thread start for single-thread groups. Note that this forces start() to block until that thread is complete. |
Here is the call graph for this function:
Here is the caller graph for this function:| void G3D::ThreadSet::terminate | ( | ) | const |
Terminate all threads that are currently started
Here is the call graph for this function:| void G3D::ThreadSet::waitForCompletion | ( | ) | const |
Waits until all started threads have completed.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Protects m_thread
1.8.8