Home | Contact | About | Search

Embedded Networking Consulting Login
emenu
emenu OS API emenu Profiler emenu MemTool emenu PCI emenu Reference emenu Links emenu
emenu emenu emenu emenu emenu emenu


Threads


threadSpawn ( )
Name: threadSpawn ( ) - spawn a thread
Synopsis:
THR_HANDLE threadSpawn
(
  s8             *s8pName,     /* C-string style name */
  PRIORITY       priority,     /* priority, lower values = higher priorites */
  ENTRY_FUNCTION fnStart,      /* entry point */
  u32            u32StackSize, /* stack size in bytes */
  u32            u32a,         /* argument 1 to pass to entry function */
  u32            u32b,         /* argument 2 to pass to entry function */
  u32            u32c,         /* argument 3 to pass to entry function */
  u32            u32d,         /* argument 4 to pass to entry function */
  u32            u32e,         /* argument 5 to pass to entry function */
  u32            u32f,         /* argument 6 to pass to entry function */
  u32            u32g,         /* argument 7 to pass to entry function */
  u32            u32h,         /* argument 8 to pass to entry function */
  u32            u32i,         /* argument 9 to pass to entry function */
  u32            u32j          /* argument 10 to pass to entry function */
)
Description: Spawns a thread. The lower the value of priority the higher the priority. The entry point fnStart has the following form:

void fnStart (u32 u32a, u32 u32b, u32 u32c, u32 u32d, u32 u32e, u32 u32f, u32 u32g, u32 u32h, u32 u32i, u32 u32j)

Include: thread.h
Returns: The THR_HANDLE of the newly created handle. Note that this function will not return if the thread cannot be created, instead the system will halt (during development) or reboot (if in the field) so there are no illegal values that can be returned.
See Also: threadDelete, threadDelay, threadSuspend, threadResume, threadLock, threadUnlock, threadPrioritySet, threadPriorityGet

threadDelete ( )
Name: threadDelete ( ) - delete a thread
Synopsis:
void threadDelete
(
  THR_HANDLE threadToDelete /* thread to delete */
)
Description: Deletes a thread from the system. Take care in using this since any resources that the thread to be deleted has allocated will not be freed. THREAD_SELF can be used to reference the calling thread. It is not recommended that threads delete other threads in the system since this can easily cause the system to lock up or cause a memory leak.
Include: thread.h
Returns: nothing
See Also: threadSpawn

threadDelay ( )
Name: threadDelay ( ) - delay a thread for a specified time
Synopsis:
void threadDelay
(
  u32 u32MillisecondsToDelay /* number of milliseconds to delay thread */
)
Description: Suspends the thread for u32MillisecondsToDelay milliseconds. The thread is delayed for at least the specified time, it may be delayed for more milliseconds.
Include: thread.h
Returns: nothing
See Also: threadSpawn

threadSuspend ( )
Name: threadSuspend ( ) - suspend a thread
Synopsis:
void threadSuspend
(
  THR_HANDLE threadToSuspend /* thread to suspend */
)
Description: Suspends a thread. THREAD_SELF can be used to reference the calling thread.
Include: thread.h
Returns: nothing
See Also: threadResume

threadResume ( )
Name: threadResume ( ) - take a thread out of the suspend state
Synopsis:
void threadResume
(
  THR_HANDLE threadToResume /* thread to take out of suspend state */
)
Description: Resumes a thread. Use this function to wake a thread that has previously called threadSuspend.
Include: thread.h
Returns: nothing
See Also: threadSuspend

threadLock ( )
Name: threadLock ( ) - disable context switching between threads
Synopsis:
void threadLock
(
  void
)
Description: Disables context switching between threads. This function can be used for critical sections of code to prevent race conditions. This function should only be used for small sections of code. Larger sections of code should use mutexes instead.

Note that calling this function twice without calling threadUnlock first is undefined behavior. In other words, nesting this call is not supported.

Include: thread.h
Returns: nothing
See Also: threadUnlock

threadUnlock ( )
Name: threadUnlock ( ) - enable context switching between threads
Synopsis:
void threadUnlock
(
  void
)
Description: Enables context switching between threads. This function is paired with threadLock.
Include: thread.h
Returns: nothing
See Also: threadLock

threadPrioritySet ( )
Name: threadPrioritySet ( ) - set priority of a thread
Synopsis:
void threadPrioritySet
(
  THR_HANDLE thread, /* thread to set priority */
  PRIORITY priority  /* new priority of thread */
)
Description: Changes the priority of the specified thread. The lower the value of priority the higher the priority. In other words, this implements inverse priorities. Valid values are between MIN_PRIORITY and MAX_PRIORITY.
Include: thread.h
Returns: nothing
See Also: threadPriorityGet

threadPriorityGet ( )
Name: threadPriorityGet ( ) - get priority of a thread
Synopsis:
PRIORITY threadPriorityGet
(
  THR_HANDLE thread /* thread to read priority */
)
Description: Retrieves the priority of the specified thread.
Include: thread.h
Returns: The priority of the specified thread.
See Also: threadPrioritySet


 


© 2001-2002 Navosha, Inc.