|
PFUNC
1.0
|
Portably creates and destroys threads on WINDOWS and Linux. More...
#include <pfunc/thread.hpp>
Public Types | |
| typedef std::map < native_thread_id_type, thread_attr * > | tls_attribute_map_type |
| typedef tls_attribute_map_type::value_type | tls_value_type |
Public Member Functions | |
| void | create_thread (thread_handle_type &handle, thread_attr *attr, start_func_type start_func_ptr, void *start_func_arg) |
| Creates a single thread. | |
| void | exit_thread () const |
| void | join_thread (const thread_handle_type &handle) const |
| native_thread_id_type | get_native_id (const thread_handle_type &handle) const |
| native_thread_id_type | get_native_id () const |
| void | tls_set (thread_attr *attr) |
| thread_attr * | tls_get () |
| int | get_num_procs () const |
| void | set_affinity (const int &proc_id) const |
Static Public Member Functions | |
| static void | yield () |
Public Attributes | |
| tls_attribute_map_type | tls_attr_map |
Portably creates and destroys threads on WINDOWS and Linux.
Only the common subset of thread creation attributes are supported.
| typedef std::map<native_thread_id_type, thread_attr*> pfunc::detail::thread::tls_attribute_map_type |
Type of thread local storage
| typedef tls_attribute_map_type::value_type pfunc::detail::thread::tls_value_type |
Type of the thread local information stored
| void pfunc::detail::thread::create_thread | ( | thread_handle_type & | handle, |
| thread_attr * | attr, | ||
| start_func_type | start_func_ptr, | ||
| void * | start_func_arg | ||
| ) | [inline] |
Creates a single thread.
| [in,out] | handle | A handle to the new thread. |
| [in] | attr | Attributes with which the thread is created. |
| [in] | start_func_ptr | Pointer to the startup function. |
| [in] | start_func_arg | Argument to the startup function. |
| void pfunc::detail::thread::exit_thread | ( | ) | const [inline] |
Exits the calling thread
| native_thread_id_type pfunc::detail::thread::get_native_id | ( | const thread_handle_type & | handle | ) | const [inline] |
Get an ID associated with the handle being passed in. For PTHREADS, this is the handle itself. On Windows, its gotten through a function call. This function is never called from the thread whose native ID we seek.
| [in] | handle | The handle of the thread whose ID is being sought |
| native_thread_id_type pfunc::detail::thread::get_native_id | ( | ) | const [inline] |
Get an ID associated with the current thread.
| int pfunc::detail::thread::get_num_procs | ( | ) | const [inline] |
Get the number of cores in the system
| void pfunc::detail::thread::join_thread | ( | const thread_handle_type & | handle | ) | const [inline] |
Exits the calling thread
| [in] | handle | handle of the thread that we are joining with. |
| void pfunc::detail::thread::set_affinity | ( | const int & | proc_id | ) | const [inline] |
Set the affinity of the thread to the given processor
| [in] | proc_id | The processor ID to bind the current thread. |
Do nothing
| thread_attr* pfunc::detail::thread::tls_get | ( | ) | [inline] |
Get the attributes in the TLS. Called from within a thread
| void pfunc::detail::thread::tls_set | ( | thread_attr * | attr | ) | [inline] |
Set the attributes in the TLS. Called from within a thread
| [in] | attr | The attribute to be set. |
| static void pfunc::detail::thread::yield | ( | ) | [inline, static] |
Yield the execution of the current thread
Thread local storage
1.7.6.1