Moving to using reference counts for process and thread structures.

This commit is contained in:
Ali Mashtizadeh 2015-01-20 15:30:11 -08:00
parent 2447babe6a
commit 63c04f37df
2 changed files with 38 additions and 4 deletions

View File

@ -75,14 +75,18 @@ void Thread_Init();
// Process functions // Process functions
Process *Process_Create(); Process *Process_Create();
void Process_Destroy(Process *proc); Process *Process_Lookup(uint64_t pid);
void Process_Retain(Process *proc);
void Process_Release(Process *proc);
uint64_t Process_Wait(Process *proc); uint64_t Process_Wait(Process *proc);
// Thread functions // Thread functions
Thread *Thread_Create(Process *proc); Thread *Thread_Create(Process *proc);
Thread *Thread_KThreadCreate(void (*f)(void*), void *arg); Thread *Thread_KThreadCreate(void (*f)(void*), void *arg);
Thread *Thread_UThreadCreate(Thread *oldThr, uint64_t rip, uint64_t arg); Thread *Thread_UThreadCreate(Thread *oldThr, uint64_t rip, uint64_t arg);
void Thread_Destroy(Thread *thr); Thread *Thread_Lookup(Process *proc, uint64_t tid);
void Thread_Retain(Thread *thr);
void Thread_Release(Thread *thr);
uint64_t Thread_Wait(Thread *thr, uint64_t tid); uint64_t Thread_Wait(Thread *thr, uint64_t tid);
// Scheduler functions // Scheduler functions

View File

@ -92,11 +92,26 @@ Process_Create()
return proc; return proc;
} }
void static void
Process_Destroy(Process *proc) Process_Destroy(Process *proc)
{ {
} }
Process *
Process_Lookup(uint64_t pid)
{
}
void
Process_Retain(Process *proc)
{
}
void
Process_Release(Process *proc)
{
}
uint64_t uint64_t
Process_Wait(Process *proc) Process_Wait(Process *proc)
{ {
@ -204,7 +219,7 @@ Thread_UThreadCreate(Thread *oldThr, uint64_t rip, uint64_t arg)
return thr; return thr;
} }
void static void
Thread_Destroy(Thread *thr) Thread_Destroy(Thread *thr)
{ {
// Free userspace stack // Free userspace stack
@ -219,6 +234,21 @@ Thread_Destroy(Thread *thr)
Slab_Free(&threadSlab, thr); Slab_Free(&threadSlab, thr);
} }
Thread *
Thread_Lookup(Process *proc, uint64_t tid)
{
}
void
Thread_Retain(Thread *thr)
{
}
void
Thread_Release(Thread *thr)
{
}
uint64_t uint64_t
Thread_Wait(Thread *thr, uint64_t tid) Thread_Wait(Thread *thr, uint64_t tid)
{ {