Codemesh Runtime v3 C++ API Reference  3.9.205
Static Public Member Functions | List of all members
xmog_thread_factory Class Reference

A class to launch threads in a platform-portable manner. More...

#include <xmog_thread_factory.h>

Static Public Member Functions

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.
 

Detailed Description

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.

Member Function Documentation

◆ spawn()

static int xmog_thread_factory::spawn ( XMOG_THREAD_FUNC  func,
void *  arg = NULL 
)
static

Starts a new thread.

Parameters
functhe thread function.
argthe 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
countthe number of new threads to start.
functhe thread function.
argthe 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_idthe value returned by an invocation of spwan_n().

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

Copyright (c) 1999-2020 by Codemesh, Inc., ALL RIGHTS RESERVED.