VEXcode IQ C++ Unofficial documentation for version 3.0.4.1
Loading...
Searching...
No Matches
vex::thread Class Reference

Use this class to create and control threads. More...

#include <vex_thread.h>

Public Member Functions

 thread (int(*callback)(void))
 Creates a thread object.
 
 thread (void(*callback)(void))
 Creates a thread object.
 
int32_t get_id ()
 Gets the ID of the thread.
 
void join ()
 Waits for the other thread to finish its execution.
 
void detach ()
 Permits the thread to execute from the thread handle.
 
bool joinable ()
 Checks whether the thread is joinable.
 
void * native_handle ()
 Gets the pointer to the native handle of the thread.
 
void swap (thread &__t)
 Swaps the thread IDs with another specified thread in the parameter.
 
void interrupt ()
 Stops the thread.
 
void setPriority (int32_t priority)
 Sets the priority of the thread.
 
int32_t priority ()
 Gets the priority of the thread.
 

Static Public Member Functions

static int32_t hardware_concurrency ()
 Gets the number of concurrent threads supported by the hardware.
 
static void swap (thread &__x, thread &__y)
 Swaps two threads specified in the parameters.
 

Static Public Attributes

static const int32_t threadPrioritylow = 1
 
static const int32_t threadPriorityNormal = 7
 
static const int32_t threadPriorityHigh = 15
 

Detailed Description

Use this class to create and control threads.

Definition at line 28 of file vex_thread.h.

Constructor & Destructor Documentation

◆ thread() [1/3]

vex::thread::thread ( )
inline

Definition at line 34 of file vex_thread.h.

◆ thread() [2/3]

vex::thread::thread ( int(* callback )(void))

Creates a thread object.

Parameters
callbackA reference to a function.

◆ thread() [3/3]

vex::thread::thread ( void(* callback )(void))
inline

Creates a thread object.

Parameters
callbackA reference to a function.

Definition at line 44 of file vex_thread.h.

Member Function Documentation

◆ detach()

void vex::thread::detach ( )
inline

Permits the thread to execute from the thread handle.

Definition at line 65 of file vex_thread.h.

◆ get_id()

int32_t vex::thread::get_id ( )

Gets the ID of the thread.

Returns
Returns an integer that represents the thread's ID.

◆ hardware_concurrency()

static int32_t vex::thread::hardware_concurrency ( )
static

Gets the number of concurrent threads supported by the hardware.

Returns
An integer that represents the amount of concurrent threads supported by the hardware.

◆ joinable()

bool vex::thread::joinable ( )

Checks whether the thread is joinable.

Returns
Returns a true Boolean if the thread is joinable.

◆ priority()

int32_t vex::thread::priority ( )

Gets the priority of the thread.

Returns
Returns the priority of the thread as an integer.

◆ setPriority()

void vex::thread::setPriority ( int32_t priority)

Sets the priority of the thread.

Parameters
priorityThe priority of the thread to be set to.

◆ swap() [1/2]

void vex::thread::swap ( thread & __t)

Swaps the thread IDs with another specified thread in the parameter.

Parameters
tThe thread to swap to.

◆ swap() [2/2]

static void vex::thread::swap ( thread & __x,
thread & __y )
inlinestatic

Swaps two threads specified in the parameters.

Parameters
xA thread to swap with the next thread set in the parameter.
yA thread to swap with the previous thread set in the parameter.

Definition at line 114 of file vex_thread.h.

Member Data Documentation

◆ threadPriorityHigh

const int32_t vex::thread::threadPriorityHigh = 15
static

Definition at line 49 of file vex_thread.h.

◆ threadPrioritylow

const int32_t vex::thread::threadPrioritylow = 1
static

Definition at line 47 of file vex_thread.h.

◆ threadPriorityNormal

const int32_t vex::thread::threadPriorityNormal = 7
static

Definition at line 48 of file vex_thread.h.


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