Manages a collection of threads. More...
Public Member Functions
|structures::unique_int||add_thread (ethread *to_add, bool start_it, void *parm)|
|adds a thread to be managed by the thread_cabinet. |
|bool||zap_thread (const structures::unique_int &to_whack)|
|removes the thread with the id "to_whack". |
|bool||cancel_thread (const structures::unique_int &to_cancel)|
|shuts down the thread "to_cancel" as quickly as possible. |
|int||threads () const|
|number of threads being managed here. |
|structures::int_set||thread_ids () const|
|returns the identifiers of all threads managed by this object. |
|bool||any_running () const|
|returns true if any threads are currently running. |
|void||start_all (void *pointer)|
|cranks up any threads that are not already running. |
|signals to all threads that they should exit as soon as possible. |
|makes all of the threads quit. |
|ethread *||get_thread (int index)|
|this returns the thread at "index" in our list. |
|clean out threads that have finished. |
Manages a collection of threads.
The thread cabinet allows one to corral a bunch of threads in one place and treat them as a group if necessary.
adds a thread to be managed by the thread_cabinet.
the thread cabinet takes over responsibility for the thread "to_add". if "start_it" is true, then the thread is started. otherwise it is left in whatever state it was in. the "parm" is passed to the thread's start() method.
|bool processes::thread_cabinet::cancel_thread||(||const structures::unique_int &||to_cancel||)|
shuts down the thread "to_cancel" as quickly as possible.
this calls the cancel() method on the thread "to_cancel", which tells the thread to stop as soon as possible. once it has stopped, the clean_debris() method will throw it and other stopped threads out.
|ethread * processes::thread_cabinet::get_thread||(||int||index||)|
|void processes::thread_cabinet::start_all||(||void *||pointer||)|
makes all of the threads quit.
they are cleaned up after they have stopped running also. any attempts to add threads while this method is operating will be rejected.
|bool processes::thread_cabinet::zap_thread||(||const structures::unique_int &||to_whack||)|
removes the thread with the id "to_whack".
if it's found and stopped and removed, true is returned. note that if the thread is found, then this will wait until the thread exits before whacking it.
Referenced by processes::post_office::unregister_route().