2#ifndef __SYS_THREAD_H__
3#define __SYS_THREAD_H__
8#include <sys/waitchannel.h>
15#include <sys/semaphore.h>
19#include <machine/pmap.h>
20#include <machine/thread.h>
25#define SCHED_STATE_NULL 0
26#define SCHED_STATE_RUNNABLE 1
27#define SCHED_STATE_RUNNING 2
28#define SCHED_STATE_WAITING 3
29#define SCHED_STATE_ZOMBIE 4
58#define PROCESS_HANDLE_SLOTS 128
59#define PROCESS_TITLE_LENGTH 128
61#define PROC_STATE_NULL 0
62#define PROC_STATE_READY 1
63#define PROC_STATE_ZOMBIE 2
106#define TID_ANY 0xFFFFFFFF
Thread * Thread_KThreadCreate(void(*f)(void *), void *arg)
int Copy_StrIn(uintptr_t fromuser, void *tokernel, uintptr_t len)
void Sched_SetWaiting(Thread *thr)
void Handle_Init(Process *proc)
Thread * Thread_Create(Process *proc)
Thread * Thread_UThreadCreate(Thread *oldThr, uint64_t rip, uint64_t arg)
int Copy_StrOut(void *fromkernel, uintptr_t touser, uintptr_t len)
Handle * Handle_Lookup(Process *proc, uint64_t fd)
void Thread_SetupKThread(Thread *thr, void(*f)(), uintptr_t arg1, uintptr_t arg2, uintptr_t arg3)
void Thread_Release(Thread *thr)
int Copy_In(uintptr_t fromuser, void *tokernel, uintptr_t len)
Process * Process_Create(Process *parent, const char *title)
void Process_Dump(Process *proc)
void Handle_Remove(Process *proc, Handle *handle)
Process * Process_Lookup(uint64_t pid)
void Sched_SetZombie(Thread *thr)
uint64_t Process_Wait(Process *proc, uint64_t pid)
void Thread_Dump(Thread *thr)
void Sched_SetRunnable(Thread *thr)
void Process_Retain(Process *proc)
void Thread_SwitchArch(Thread *oldthr, Thread *newthr)
int Copy_Out(void *fromkernel, uintptr_t touser, uintptr_t len)
uint64_t Handle_Add(Process *proc, Handle *handle)
void Handle_Destroy(Process *proc)
uint64_t Thread_Wait(Thread *thr, uint64_t tid)
void Thread_SetupUThread(Thread *thr, uint64_t rip, uint64_t arg)
void Process_Release(Process *proc)
#define PROCESS_HANDLE_SLOTS
Thread * Thread_Lookup(Process *proc, uint64_t tid)
void Thread_InitArch(Thread *thr)
#define PROCESS_TITLE_LENGTH
void Thread_Retain(Thread *thr)
#define TAILQ_HEAD(name, type)
HandleQueue handles[PROCESS_HANDLE_SLOTS]
TAILQ_ENTRY(Process) siblingList
char title[PROCESS_TITLE_LENGTH]
Semaphore zombieSemaphore
ProcessQueue childrenList
TAILQ_ENTRY(Process) processList
TAILQ_ENTRY(Thread) schedQueue
TAILQ_ENTRY(Thread) semaQueue
TAILQ_ENTRY(Thread) threadList
TAILQ_ENTRY(Thread) chanQueue