VEX IQ C++ API
Public Member Functions | List of all members
vex::thread Class Reference

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

Public Member Functions

 thread (void(*callback)(void), size_t stack_size=1024)
 Creates a thread object. More...
 
 ~thread ()
 
int32_t get_id ()
 Gets the ID of the thread. More...
 
void join ()
 Waits for the other thread to finish its execution. More...
 
bool joinable ()
 Permits the thread to execute from the thread handle. More...
 
void interrupt ()
 Stops the thread. More...
 

Detailed Description

Use this class to create and control threads.

Constructor & Destructor Documentation

◆ thread()

vex::thread::thread ( void(*)(void)  callback,
size_t  stack_size = 1024 
)

Creates a thread object.

Parameters
callbackA reference to a function.
stack_sizeSize of stack allocated in bytes (default 1024)

◆ ~thread()

vex::thread::~thread ( )

Member Function Documentation

◆ get_id()

int32_t vex::thread::get_id ( )

Gets the ID of the thread.

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

◆ join()

void vex::thread::join ( )

Waits for the other thread to finish its execution.

◆ joinable()

bool vex::thread::joinable ( )

Permits the thread to execute from the thread handle.

Checks whether the thread is joinable.

Returns
Returns a true Boolean if the thread is joinable.

◆ interrupt()

void vex::thread::interrupt ( )

Stops the thread.