1 #ifndef _THREADS_INT_H_
2 #define _THREADS_INT_H_
7 typedef struct sMessage
9 struct sMessage *Next; //!< Next message in thread's inbox
10 tTID Source; //!< Source thread ID
11 Uint Length; //!< Length of message data in bytes
12 Uint8 Data[]; //!< Message data
15 typedef struct sProcess
26 struct sThread *GlobalNext;
34 struct sThread *Parent;
38 int Status; // 0: Dead, 1: Active, 2: Paused, 3: Asleep
42 // Threads waiting for this thread to exit.
44 // - Wait for `WaitingThreads` to be non-null (maybe?)
45 // - Wake first in the queue, wait for it to be removed
47 // - Free thread and quit kernel thread
48 struct sThread *WaitingThreads;
49 struct sThread *WaitingThreadsEnd;
53 Uint32 Events, WaitMask;
54 void *EventSem; // Should be SDL_sem, but I don't want SDL in this header
57 tMsg * volatile Messages; //!< Message Queue
58 tMsg *LastMessage; //!< Last Message (speeds up insertion)
62 THREAD_STAT_NULL, // Invalid process
63 THREAD_STAT_ACTIVE, // Running and schedulable process
64 THREAD_STAT_SLEEPING, // Message Sleep
65 THREAD_STAT_MUTEXSLEEP, // Mutex Sleep
66 THREAD_STAT_SEMAPHORESLEEP, // Semaphore Sleep
67 THREAD_STAT_QUEUESLEEP, // Queue
68 THREAD_STAT_EVENTSLEEP, // Event sleep
69 THREAD_STAT_WAITING, // ??? (Waiting for a thread)
70 THREAD_STAT_PREINIT, // Being created
71 THREAD_STAT_ZOMBIE, // Died/Killed, but parent not informed
72 THREAD_STAT_DEAD, // Awaiting burial (free)
73 THREAD_STAT_BURIED // If it's still on the list here, something's wrong
75 extern tThread *Threads_GetThread(Uint TID);