include/razorback/thread.h File Reference

Threading API. More...

#include <razorback/visibility.h>
#include <razorback/types.h>
#include <razorback/lock.h>
#include <razorback/api.h>
#include <pthread.h>
Include dependency graph for thread.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Thread
 Thread Purpose: hold the information about a thread. More...

Typedefs

typedef pthread_t rzb_thread_t

Functions

SO_PUBLIC struct ThreadThread_Launch (void(*function)(struct Thread *), void *userData, char *name, struct RazorbackContext *context)
 Create a new thread.
SO_PUBLIC struct RazorbackContextThread_ChangeContext (struct Thread *thread, struct RazorbackContext *context)
 Change the registered context of a running thread.
SO_PUBLIC struct RazorbackContextThread_GetContext (struct Thread *p_pThread)
 Get the registered context of a running thread.
SO_PUBLIC struct RazorbackContextThread_GetCurrentContext (void)
 Get the running context for the current thread.
SO_PUBLIC void Thread_Destroy (struct Thread *thread)
 Destroy a threads data.
SO_PUBLIC bool Thread_IsRunning (struct Thread *thread)
 Checks whether a thread is running or not.
SO_PUBLIC bool Thread_IsStopped (struct Thread *thread)
 Check if a thread has finished.
SO_PUBLIC void Thread_Join (struct Thread *thread)
 Suspend execution of the calling thread until the target thread therminates.
SO_PUBLIC void Thread_Interrupt (struct Thread *thread)
 Interrupt the target thread.
SO_PUBLIC void Thread_Stop (struct Thread *thread)
 Stop the target thread.
SO_PUBLIC void Thread_StopAndJoin (struct Thread *thread)
SO_PUBLIC void Thread_InterruptAndJoin (struct Thread *thread)
SO_PUBLIC void Thread_Yield (void)
 Cause the current thread to yield execution to other runnable threads.
SO_PUBLIC uint32_t Thread_getCount (void)
 Get the number of currently running threads.
SO_PUBLIC struct ThreadThread_GetCurrent (void)
 Get the current thread.
SO_PUBLIC rzb_thread_t Thread_GetCurrentId (void)
 Get the current thread ID.
SO_PUBLIC int Thread_KeyCmp (void *a, void *id)
SO_PUBLIC int Thread_Cmp (void *a, void *b)

Detailed Description

Threading API.


Function Documentation

SO_PUBLIC struct RazorbackContext* Thread_ChangeContext ( struct Thread thread,
struct RazorbackContext context 
) [read]

Change the registered context of a running thread.

Parameters:
thread the thread to change
context the new context
Returns:
The old context
SO_PUBLIC void Thread_Destroy ( struct Thread thread  ) 

Destroy a threads data.

Parameters:
*thread The thread to destroy
SO_PUBLIC struct RazorbackContext* Thread_GetContext ( struct Thread p_pThread  )  [read]

Get the registered context of a running thread.

Parameters:
thread the thread to change
Returns:
The current context for the thread.
SO_PUBLIC uint32_t Thread_getCount ( void   ) 

Get the number of currently running threads.

Returns:
the number of currently running threads.
SO_PUBLIC struct RazorbackContext* Thread_GetCurrentContext ( void   )  [read]

Get the running context for the current thread.

Returns:
The current context.
SO_PUBLIC void Thread_Interrupt ( struct Thread thread  ) 

Interrupt the target thread.

Parameters:
thread The target thread.
SO_PUBLIC bool Thread_IsRunning ( struct Thread thread  ) 

Checks whether a thread is running or not.

Parameters:
*thread The thread the test
Returns:
true if running, false if not
SO_PUBLIC bool Thread_IsStopped ( struct Thread thread  ) 

Check if a thread has finished.

Parameters:
thread The thread to test.
Returns:
true if the thread has exited, false if its still running.
SO_PUBLIC void Thread_Join ( struct Thread thread  ) 

Suspend execution of the calling thread until the target thread therminates.

Parameters:
thread The target thread.
SO_PUBLIC struct Thread* Thread_Launch ( void(*)(struct Thread *)  function,
void *  userData,
char *  name,
struct RazorbackContext context 
) [read]

Create a new thread.

Parameters:
*function The function the thread will execute
*userData The thread user data
*name The name of the thread
*context The initial context of the thread
Returns:
Null on error a new Thread on success.
SO_PUBLIC void Thread_Stop ( struct Thread thread  ) 

Stop the target thread.

Parameters:
thread The target thread.
 All Data Structures Files Functions Variables Enumerations Enumerator Defines
Generated on Sun Dec 9 04:00:11 2012 for RazorbackAPI by  doxygen 1.6.3