VectorNav C Library
Data Structures | Typedefs | Functions
thread.h File Reference
#include "vn/error.h"
#include "vn/int.h"

Go to the source code of this file.

Data Structures

struct  VnThread
 Structure for working with threads. More...
 

Typedefs

typedef void(* VnThread_StartRoutine) (void *)
 Function signature for a start routine for a thread.
 

Functions

VnError VnThread_startNew (VnThread *thread, VnThread_StartRoutine startRoutine, void *routineData)
 Starts a new thread immediately which calls the provided start routine. More...
 
VnError VnThread_join (VnThread *thread)
 Blocks the calling thread until the referenced thread finishes. More...
 
void VnThread_sleepSec (uint32_t numOfSecsToSleep)
 Causes the calling thread to sleep the specified number of seconds. More...
 
void VnThread_sleepMs (uint32_t numOfMsToSleep)
 Causes the calling thread to sleep the specified number of milliseconds. More...
 
void VnThread_sleepUs (uint32_t numOfUsToSleep)
 Causes the calling thread to sleep the specified number of microseconds. More...
 

Detailed Description

{COMMON_HEADER}

DESCRIPTION

This header file contains structures and functions useful working with threads.

Function Documentation

VnError VnThread_join ( VnThread thread)

Blocks the calling thread until the referenced thread finishes.

Parameters
[in]threadThe associated VnThread.
Returns
Any errors encountered.
void VnThread_sleepMs ( uint32_t  numOfMsToSleep)

Causes the calling thread to sleep the specified number of milliseconds.

Parameters
[in]numOfMsToSleepThe number of milliseconds to sleep.
Examples:
ez_async_data/main.c, and spi/main.c.
void VnThread_sleepSec ( uint32_t  numOfSecsToSleep)

Causes the calling thread to sleep the specified number of seconds.

Parameters
[in]numOfSecsToSleepThe number of seconds to sleep.
Examples:
sensor/main.c.
void VnThread_sleepUs ( uint32_t  numOfUsToSleep)

Causes the calling thread to sleep the specified number of microseconds.

Parameters
[in]numOfUsToSleepThe number of microseconds to sleep.
VnError VnThread_startNew ( VnThread thread,
VnThread_StartRoutine  startRoutine,
void *  routineData 
)

Starts a new thread immediately which calls the provided start routine.

Parameters
[in]threadAssociated VnThread structure.
[in]startRoutineThe routine to be called when the new thread is started.
[in]routineDataPointer to data that will be passed to the routine on the new thread.
Returns
Any errors encountered.