ThingWorx C SDK
|
Wrappers for OS-specific threading functionality. More...
#include <stdint.h>
#include <stdlib.h>
#include <time.h>
#include "twDefinitions.h"
#include "twOSPort.h"
#include "twTasker.h"
Go to the source code of this file.
Classes | |
struct | twThread |
twThread structure definition. More... | |
Typedefs | |
typedef struct twThread | twThread |
twThread structure definition. More... | |
Functions | |
twThread * | twThread_Create (twTaskFunction func, uint32_t rate, void *opaquePtr, char autoStart) |
Creates a new twThread. More... | |
void | twThread_Delete (void *t) |
Frees all memory associated with a twThread and all of its owned substructures. More... | |
int | twThread_Start (twThread *t) |
Starts a twThread. More... | |
int | twThread_Stop (twThread *t, int32_t waitTime) |
Stops a twThread. More... | |
int | twThread_Pause (twThread *t) |
Pauses a twThread. More... | |
int | twThread_Resume (twThread *t) |
Resumes a twThread. More... | |
char | twThread_IsRunning (twThread *t) |
Checks if a twThread is running via twThread::isRunning of t . More... | |
char | twThread_IsPaused (twThread *t) |
Checks if a twThread is paused via twThread::isPaused of t . More... | |
char | twThread_IsStopped (twThread *t) |
Checks if a twThread has stopped via twThread::hasStopped of t . More... | |
TW_THREAD_ID | twThread_GetThreadId (twThread *t) |
Gets the id of a thread via twThread::id of t . More... | |
Wrappers for OS-specific threading functionality.
twThread structure definition.
twThread* twThread_Create | ( | twTaskFunction | func, |
uint32_t | rate, | ||
void * | opaquePtr, | ||
char | autoStart | ||
) |
Creates a new twThread.
[in] | func | The twTaskFunction of the thread. |
[in] | rate | TBD |
[in] | opaquePtr | An opaque pointer passed into the thread for any user purpose. |
[in] | autoStart | #TRUE has new thread start automatically. |
void twThread_Delete | ( | void * | t | ) |
Frees all memory associated with a twThread and all of its owned substructures.
[in] | t | A pointer to the twThread to be deleted. |
TW_THREAD_ID twThread_GetThreadId | ( | twThread * | t | ) |
Gets the id of a thread via twThread::id of t
.
[in] | t | The twThread to get the id of. |
t
. 0 if t
was NULL. char twThread_IsPaused | ( | twThread * | t | ) |
Checks if a twThread is paused via twThread::isPaused of t
.
[in] | t | The twThread to check. |
char twThread_IsRunning | ( | twThread * | t | ) |
Checks if a twThread is running via twThread::isRunning of t
.
[in] | t | The twThread to check. |
char twThread_IsStopped | ( | twThread * | t | ) |
Checks if a twThread has stopped via twThread::hasStopped of t
.
[in] | t | The twThread to check. |
int twThread_Pause | ( | twThread * | t | ) |
Pauses a twThread.
[in] t A pointer to the twThread to pause.
int twThread_Resume | ( | twThread * | t | ) |
Resumes a twThread.
[in] t A pointer to the twThread to resume.
int twThread_Start | ( | twThread * | t | ) |
Starts a twThread.
[in] t A pointer to the twThread to start.
int twThread_Stop | ( | twThread * | t, |
int32_t | waitTime | ||
) |
Stops a twThread.
[in] t A pointer to the twThread to stop.
[in] | waitTime | How long to wait for the twThread to stop after a shutdown request is set. |
waitTime
, the thread is canceled.