Threads.cpp File Reference

#include <SysThread.h>
#include <CmnErrors.h>
#include <pthread.h>
#include <signal.h>
#include <semaphore.h>
#include <assert.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/syscall.h>
#include <unistd.h>
#include <SysThreadConcealed.h>
#include <cxxabi.h>
#include <sys/time.h>
#include <sys/resource.h>

Namespaces

namespace  palmos

Defines

#define sysConditionVariableOpened   1

Functions

void cleanup (void *arg)
void palmos::cleanupNamedTSDKeys (void)
void FreePrimaryThread (void *)
void group_add (struct our_thread_group_record *, struct our_thread_init_record *)
void group_remove (struct our_thread_group_record *, struct our_thread_init_record *)
VAddr KALPrivGetStackPointer (void)
void * our_thread_startup (void *arg)
our_thread_init_record * SetupPrimaryThread ()
void SysConditionVariableBroadcast (SysConditionVariableType *iCV)
void SysConditionVariableClose (SysConditionVariableType *iCV)
void SysConditionVariableOpen (SysConditionVariableType *iCV)
void SysConditionVariableWait (SysConditionVariableType *iCV, SysCriticalSectionType *iOptionalCS)
void SysCriticalSectionDestroy (SysCriticalSectionType *iCS)
void SysCriticalSectionEnter (SysCriticalSectionType *iCS)
void SysCriticalSectionExit (SysCriticalSectionType *iCS)
void SysCriticalSectionInit (SysCriticalSectionType *iCS)
SysHandle SysCurrentThread (void)
 Return the handle for the calling thread.
status_t SysThreadChangePriority (SysHandle thread, uint8_t priority)
 Change a thread's priority.
status_t SysThreadCreate (SysThreadGroupHandle group, const char *name, uint8_t priority, uint32_t stackSize, SysThreadEnterFunc *func, void *argument, SysHandle *outThread)
 Like SysThreadCreateEZ(), but with more stuff.
status_t SysThreadCreateEZ (const char *name, SysThreadEnterFunc *func, void *argument, SysHandle *outThread)
void SysThreadExit (void)
 Call this function to have the current thread exit.
status_t SysThreadGetDirectFuncs (sysThreadDirectFuncs *ioFuncs)
SysThreadGroupHandle SysThreadGroupCreate (void)
status_t SysThreadGroupDestroy (SysThreadGroupHandle h)
status_t SysThreadGroupWait (SysThreadGroupHandle h)
status_t SysThreadInstallExitCallback (SysThreadExitCallbackFunc *iExitCallbackP, void *iCallbackArg, SysThreadExitCallbackID *oThreadExitCallbackId)
int SysThreadKill (SysHandle thread, int signo)
 Deliver a POSIX signal to a thread.
pthread_t SysThreadPthread (SysHandle thread)
status_t SysThreadRemoveExitCallback (SysThreadExitCallbackID iThreadCallbackId)
status_t SysThreadStart (SysHandle thread)
 Start a thread that was created above with SysThreadCreate() or SysThreadCreateEZ().

Variables

int __dso_handle
pthread_key_t currentThreadRecord = 0
sysThreadDirectFuncs g_threadDirectFuncs
palmos::libpalmroot_constructor palmos::global_libpalmroot_constructor
const int group_rec_MAGIC = 0x9811232
const int our_thread_exit_record_MAGIC = 0x2439714
const int our_thread_group_record_MAGIC = 0x12734123
const int our_thread_init_record_MAGIC = 0x12934126
bool PrimaryThreadFreed = false
bool PrimaryThreadSetup = false


Define Documentation

#define sysConditionVariableOpened   1
 


Function Documentation

void cleanup void *  arg  ) 
 

void FreePrimaryThread void *   ) 
 

void group_add struct our_thread_group_record *  ,
struct our_thread_init_record * 
 

void group_remove struct our_thread_group_record *  ,
struct our_thread_init_record * 
 

VAddr KALPrivGetStackPointer void   ) 
 

void* our_thread_startup void *  arg  ) 
 

our_thread_init_record * SetupPrimaryThread  ) 
 

void SysConditionVariableBroadcast SysConditionVariableType iCV  ) 
 

void SysConditionVariableClose SysConditionVariableType iCV  ) 
 

void SysConditionVariableOpen SysConditionVariableType iCV  ) 
 

void SysConditionVariableWait SysConditionVariableType iCV,
SysCriticalSectionType iOptionalCS
 

void SysCriticalSectionDestroy SysCriticalSectionType iCS  ) 
 

void SysCriticalSectionEnter SysCriticalSectionType iCS  ) 
 

void SysCriticalSectionExit SysCriticalSectionType iCS  ) 
 

void SysCriticalSectionInit SysCriticalSectionType iCS  ) 
 

SysHandle SysCurrentThread void   ) 
 

Return the handle for the calling thread.

status_t SysThreadChangePriority SysHandle  thread,
uint8_t  priority
 

Change a thread's priority.

status_t SysThreadCreate SysThreadGroupHandle  group,
const char *  name,
uint8_t  priority,
uint32_t  stackSize,
SysThreadEnterFunc func,
void *  argument,
SysHandle outThread
 

Like SysThreadCreateEZ(), but with more stuff.

Parameters:
[in] group Thread group, normally sysThreadNoGroup.
[in] name First four letters are used for thread ID.
[in] priority Pick one of the thread priority constants.
[in] stackSize Bytes available for the thread's stack.
[in] func Entry point of thread.
[in] argument Data passed to above.
[out] outThtread Returned thread handle.

status_t SysThreadCreateEZ const char *  name,
SysThreadEnterFunc func,
void *  argument,
SysHandle outThread
 

void SysThreadExit void   ) 
 

Call this function to have the current thread exit.

The thread MUST have been created with SysThreadCreate().

status_t SysThreadGetDirectFuncs sysThreadDirectFuncs ioFuncs  ) 
 

SysThreadGroupHandle SysThreadGroupCreate void   ) 
 

status_t SysThreadGroupDestroy SysThreadGroupHandle  h  ) 
 

status_t SysThreadGroupWait SysThreadGroupHandle  h  ) 
 

status_t SysThreadInstallExitCallback SysThreadExitCallbackFunc iExitCallbackP,
void *  iCallbackArg,
SysThreadExitCallbackID oThreadExitCallbackId
 

int SysThreadKill SysHandle  thread,
int  signo
 

Deliver a POSIX signal to a thread.

Parameters:
[in] thread Thread handle as returned by the creation function.
[in] signo Signal number
Returns a status value the same as kill().

pthread_t SysThreadPthread SysHandle  thread  ) 
 

status_t SysThreadRemoveExitCallback SysThreadExitCallbackID  iThreadCallbackId  ) 
 

status_t SysThreadStart SysHandle  thread  ) 
 

Start a thread that was created above with SysThreadCreate() or SysThreadCreateEZ().

Parameters:
[in] thread Thread handle as returned by the creation function.
If this function fails, the thread handle and all associated resources will be deallocated.


Variable Documentation

int __dso_handle
 

pthread_key_t currentThreadRecord = 0
 

sysThreadDirectFuncs g_threadDirectFuncs
 

const int group_rec_MAGIC = 0x9811232
 

const int our_thread_exit_record_MAGIC = 0x2439714
 

const int our_thread_group_record_MAGIC = 0x12734123
 

const int our_thread_init_record_MAGIC = 0x12934126
 

bool PrimaryThreadFreed = false
 

bool PrimaryThreadSetup = false