X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Tools%2Fnativelib%2Finclude%2Fthreads_int.h;h=36e5aba3ca863d2bd37aa2feaa141ea5863d2711;hb=3241c317ee9f714eba6a0fa82de79cfe5f104993;hp=eb5f9dffbf56c3a4d0da1ad84b8093b4bf834eff;hpb=0ab008276f88801b5a5a2ed8e96c285e524ead2c;p=tpg%2Facess2.git diff --git a/Tools/nativelib/include/threads_int.h b/Tools/nativelib/include/threads_int.h index eb5f9dff..36e5aba3 100644 --- a/Tools/nativelib/include/threads_int.h +++ b/Tools/nativelib/include/threads_int.h @@ -8,33 +8,65 @@ #ifndef _THREADS_INT_H_ #define _THREADS_INT_H_ +#define THREAD_EVENT_RWLOCK (1 << 8) + +typedef struct sThreadIntMutex tThreadIntMutex; // actually pthreads +typedef struct sThreadIntSem tThreadIntSem; + struct sProcess { struct sProcess *Next; + struct sThread *Threads; int PID; int UID, GID; char *CWD; char *Chroot; + int MaxFDs; + void *Handles; }; struct sThread { struct sThread *Next; + struct sThread *ListNext; + + struct sProcess *Process; + struct sThread *ProcNext; + + void *ThreadHandle; int TID; - + + tThreadIntMutex *Protector; + uint32_t PendingEvents; uint32_t WaitingEvents; - void *WaitSemaphore; // pthreads - + tThreadIntSem *WaitSemaphore; // pthreads + + char *Name; + // Init Only void (*SpawnFcn)(void*); void *SpawnData; }; +extern struct sThread __thread *lpThreads_This; + extern int Threads_int_CreateThread(struct sThread *Thread); +extern int Threads_int_ThreadingEnabled(void); + +extern tThreadIntMutex *Threads_int_MutexCreate(void); +extern void Threads_int_MutexDestroy(tThreadIntMutex *Mutex); +extern void Threads_int_MutexLock(tThreadIntMutex *Mutex); +extern void Threads_int_MutexRelease(tThreadIntMutex *Mutex); + +extern tThreadIntSem *Threads_int_SemCreate(void); +extern void Threads_int_SemDestroy(tThreadIntSem *Sem); +extern void Threads_int_SemSignal(tThreadIntSem *Sem); +extern void Threads_int_SemWait(tThreadIntSem *Sem); +extern void Threads_int_SemWaitAll(tThreadIntSem *Sem); #endif