nativelib - Implimenting missing functions
[tpg/acess2.git] / Tools / nativelib / include / threads_int.h
1 /*
2  * Acess2 libnative (Kernel Simulation Library)
3  * - By John Hodge (thePowersGang)
4  *
5  * threads_int.h
6  * - Threads handling definitions
7  */
8 #ifndef _THREADS_INT_H_
9 #define _THREADS_INT_H_
10
11 typedef struct sThreadIntMutex  tThreadIntMutex;        // actually pthreads
12 typedef struct sThreadIntSem    tThreadIntSem;
13
14 struct sProcess
15 {
16         struct sProcess *Next;
17
18          int    PID;
19          int    UID, GID;
20         
21         char    *CWD;
22         char    *Chroot;
23          int    MaxFDs;
24 };
25
26 struct sThread
27 {
28         struct sThread  *Next;
29         void    *ThreadHandle;
30          int    TID;
31
32         tThreadIntMutex *Protector;
33
34         uint32_t        PendingEvents;
35         uint32_t        WaitingEvents;
36         tThreadIntSem   *WaitSemaphore; // pthreads
37         
38         // Init Only
39         void    (*SpawnFcn)(void*);
40         void    *SpawnData;
41 };
42
43 extern int      Threads_int_CreateThread(struct sThread *Thread);
44
45 extern tThreadIntMutex  *Threads_int_MutexCreate(void);
46 extern void     Threads_int_MutexDestroy(tThreadIntMutex *Mutex);
47 extern void     Threads_int_MutexLock(tThreadIntMutex *Mutex);
48 extern void     Threads_int_MutexRelease(tThreadIntMutex *Mutex);
49
50 extern tThreadIntSem    *Threads_int_SemCreate(void);
51 extern void     Threads_int_SemDestroy(tThreadIntSem *Sem);
52 extern void     Threads_int_SemSignal(tThreadIntSem *Sem);
53 extern void     Threads_int_SemWait(tThreadIntSem *Sem);
54 extern void     Threads_int_SemWaitAll(tThreadIntSem *Sem);
55
56 #endif
57

UCC git Repository :: git.ucc.asn.au