spBase
|
Macros | |
#define | SP_THREAD_PRIORITY_TIME_CRITICAL 15 |
#define | SP_THREAD_PRIORITY_HIGHEST 2 |
#define | SP_THREAD_PRIORITY_ABOVE_NORMAL 1 |
#define | SP_THREAD_PRIORITY_NORMAL 0 |
#define | SP_THREAD_PRIORITY_BELOW_NORMAL (-1) |
#define | SP_THREAD_PRIORITY_LOWEST (-2) |
#define | SP_THREAD_PRIORITY_IDLE (-15) |
#define | SP_EVENT_TIMEOUT_INFINITE -1 |
#define | SP_EVENT_WAIT_FAILED -1 |
#define | SP_EVENT_WAIT_SIGNALED 0 |
#define | SP_EVENT_WAIT_TIMEOUT 1 |
#define | SP_EVENT_WAIT_ABANDONED 2 |
Typedefs | |
typedef void(* | spCommandThreadCallback) (spCommandThreadStatus status, long data, void *user_data) |
Enumerations | |
enum | spCommandThreadStatus { SP_COMMAND_THREAD_STARTED = 0 , SP_COMMAND_THREAD_FINISHED = 1 , SP_COMMAND_THREAD_COMMAND_FINISHED = 2 , SP_COMMAND_THREAD_COMMAND_FAILED = 3 , SP_COMMAND_THREAD_COMMAND_WAIT_FAILED = 4 } |
Functions | |
void * | spCreateThread (long stacksize, int priority, spThreadFunc func, void *data) |
void | spDestroyThread (void *handle) |
void | spExitThread (long status) |
void | spYieldThread (void) |
long | spWaitThread (void *handle) |
spThreadId | spGetThreadId (void *handle) |
spThreadId | spGetCurrentThreadId (void) |
spBool | spEqThreadId (spThreadId id1, spThreadId id2) |
void * | spCreateMutex (const char *name) |
void | spDestroyMutex (void *handle) |
spBool | spLockMutex (void *handle) |
spBool | spUnlockMutex (void *handle) |
spBool | spWaitMutex (void *handle) |
void * | spCreateEvent (spBool manual_reset, spBool initial_signal) |
spBool | spDestroyEvent (void *handle) |
int | spWaitEventTimeout (void *handle, long timeout_ms) |
spBool | spWaitEvent (void *handle) |
spBool | spSetEvent (void *handle) |
spBool | spResetEvent (void *handle) |
spBool | spPulseEvent (void *handle) |
spBool | spCreateCommandThread (const char *command, spCommandThreadCallback func, void *data) |
#define SP_THREAD_PRIORITY_TIME_CRITICAL 15 |
Thread priority for really time critical processing (higher than the highest thread priority).
#define SP_THREAD_PRIORITY_HIGHEST 2 |
Highest thread priority.
#define SP_THREAD_PRIORITY_ABOVE_NORMAL 1 |
Thread priority above normal.
#define SP_THREAD_PRIORITY_NORMAL 0 |
Normal thread priority.
#define SP_THREAD_PRIORITY_BELOW_NORMAL (-1) |
Thread priority below normal.
#define SP_THREAD_PRIORITY_LOWEST (-2) |
Lowest thread priority.
#define SP_THREAD_PRIORITY_IDLE (-15) |
Thread priority for idle state (lower than the lowest thread priority).
#define SP_EVENT_TIMEOUT_INFINITE -1 |
Infinite timeout for spWaitEventTimeout() .
#define SP_EVENT_WAIT_FAILED -1 |
Waiting for the event object failed.
#define SP_EVENT_WAIT_SIGNALED 0 |
The event object signaled.
#define SP_EVENT_WAIT_TIMEOUT 1 |
Timeout period elapsed.
#define SP_EVENT_WAIT_ABANDONED 2 |
Waiting for the event object is abandoned.
typedef void(* spCommandThreadCallback) (spCommandThreadStatus status, long data, void *user_data) |
Signature of the callback function for spCreateCommandThread() .
Status of the command thread. This status can be accessed as the 1st argument of spCommandThreadCallback .
|
extern |
Creates a new thread. The created thread must be destroyed by spDestroyThread() .
|
extern |
Destroys the thread created by spCreateThread() .
|
extern |
Exits the current thread created by spCreateThread() . The behavior of calling this function from the thread created by a function other than spCreatedThread() is undefined.
|
extern |
Yields ownership of the current thread to other threads. This function is valid for environment that can gain only one ownership simultaneously such as Mac OS 9.
|
extern |
Waits the thread created by spCreateThread() .
|
extern |
Gets the ID of the thread.
|
extern |
Gets the ID of the current thread.
|
extern |
Check whether two thread IDs are the same.
|
extern |
Creates a new mutex object.
|
extern |
Destroyes the mutex object created by spCreateMutex() .
|
extern |
Gains ownership of the mutex object.
|
extern |
Relinquishes ownership of the mutex object.
|
extern |
Waits for access to the mutex object.
Creates a new event object.
|
extern |
Destroyes the event object created by spCreateEvent() .
|
extern |
Waits for the event object to be a signaled state.
|
extern |
Waits for the event object to be a signaled state.
|
extern |
Sets the event object to a signaled state.
|
extern |
Resets the event object to a nonsignaled state.
|
extern |
Sets the event object to a signaled state, and then promptly resets that to a nonsignaled state.
|
extern |
Executes the command in a thread.
[in] | command | The null-terminated command executed. |
[in] | func | The callback function which has the following signature ( spCommandThreadCallback ): |
[in] | data | The user data for the callback function. You can obtain this address as the 3rd argument of the callback function. |
SP_TRUE | Success |
SP_FALSE | Failure |