A class to launch threads in a platform-portable manner.
More...
#include <xmog_thread_factory.h>
|
static int | spawn (XMOG_THREAD_FUNC func, void *arg=NULL) |
| Starts a new thread. More...
|
|
static int | spawn_n (size_t count, XMOG_THREAD_FUNC func, void *arg=NULL) |
| Starts a number of new threads. More...
|
|
static void | wait_n (int grp_id) |
| Waits for completion of all threads started by an invocation of spawn_n(). More...
|
|
static void | cleanup () |
| Cleans up behind the threads that were spawned.
|
|
A class to launch threads in a platform-portable manner.
This class is intended to support platform-portable thread-related testcases for the runtime library.
◆ spawn()
static int xmog_thread_factory::spawn |
( |
XMOG_THREAD_FUNC |
func, |
|
|
void * |
arg = NULL |
|
) |
| |
|
static |
Starts a new thread.
- Parameters
-
func | the thread function. |
arg | the argument for the threadfunction. |
- Returns
- 0 on success, other number on failure.
◆ spawn_n()
static int xmog_thread_factory::spawn_n |
( |
size_t |
count, |
|
|
XMOG_THREAD_FUNC |
func, |
|
|
void * |
arg = NULL |
|
) |
| |
|
static |
Starts a number of new threads.
- Parameters
-
count | the number of new threads to start. |
func | the thread function. |
arg | the argument for the threadfunction. |
- Returns
- -1 on failure, the group id of the launched threads otherwise. The group id can be used to wait for completion using the wait_n() function.
◆ wait_n()
static void xmog_thread_factory::wait_n |
( |
int |
grp_id | ) |
|
|
static |
Waits for completion of all threads started by an invocation of spawn_n().
- Parameters
-
grp_id | the value returned by an invocation of spwan_n(). |
The documentation for this class was generated from the following file: