nativelib - Compile fixes
[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          int    TID;
30
31         tThreadIntMutex *Protector;
32
33         uint32_t        PendingEvents;
34         uint32_t        WaitingEvents;
35         tThreadIntSem   *WaitSemaphore; // pthreads
36         
37         // Init Only
38         void    (*SpawnFcn)(void*);
39         void    *SpawnData;
40 };
41
42 extern int      Threads_int_CreateThread(struct sThread *Thread);
43
44 extern tThreadIntMutex  *Threads_int_MutexCreate(void);
45 extern void     Threads_int_MutexDestroy(tThreadIntMutex *Mutex);
46 extern void     Threads_int_MutexLock(tThreadIntMutex *Mutex);
47 extern void     Threads_int_MutexRelease(tThreadIntMutex *Mutex);
48
49 extern tThreadIntSem    *Threads_int_SemCreate(void);
50 extern void     Threads_int_SemDestroy(tThreadIntSem *Sem);
51 extern void     Threads_int_SemSignal(tThreadIntSem *Sem);
52 extern void     Threads_int_SemWait(tThreadIntSem *Sem);
53 extern void     Threads_int_SemWaitAll(tThreadIntSem *Sem);
54
55 #endif
56

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