GraphLab: Distributed Graph-Parallel API  2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
graphlab::thread_group Class Reference

#include <graphlab/parallel/pthread_tools.hpp>

List of all members.

Public Member Functions

 thread_group ()
void launch (const boost::function< void(void)> &spawn_function)
void launch (const boost::function< void(void)> &spawn_function, size_t cpu_id)
void join ()
size_t running_threads ()
 Returns the number of running threads.
 ~thread_group ()
 Destructor. Waits for all threads to complete execution.

Detailed Description

Manages a collection of threads.

The thread_group object performs limited exception forwarding. exception throws within a thread of type const char* will be caught and forwarded to the join() function. If the call to join() is wrapped by a try-catch block, the exception will be caught safely and thread cleanup will be completed properly.

If multiple threads are running in the thread-group, the master should test if running_threads() is > 0, and retry the join().

Definition at line 904 of file pthread_tools.hpp.


Constructor & Destructor Documentation

graphlab::thread_group::thread_group ( )
inline

Initializes a thread group.

Definition at line 919 of file pthread_tools.hpp.


Member Function Documentation

void graphlab::thread_group::join ( )
Waits for all threads to complete execution. const char* exceptions

thrown by threads are forwarded to the join() function.

Definition at line 339 of file pthread_tools.cpp.

void graphlab::thread_group::launch ( const boost::function< void(void)> &  spawn_function)

Launch a single thread which calls spawn_function No CPU affinity is set so which core it runs on is up to the OS Scheduler

Definition at line 313 of file pthread_tools.cpp.

void graphlab::thread_group::launch ( const boost::function< void(void)> &  spawn_function,
size_t  cpu_id 
)

Launch a single thread which calls spawn_function Also sets CPU Affinity

Definition at line 324 of file pthread_tools.cpp.


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