Harmonize kthread func naming
This commit is contained in:
parent
59a8d3b582
commit
0c389afa8f
@ -7,13 +7,13 @@
|
||||
|
||||
static struct kthread *currentThread;
|
||||
|
||||
void kthread_exit(){
|
||||
void kthreadExit(){
|
||||
struct kthread *current = currentThread;
|
||||
struct kthread *next = selectNextKthread();
|
||||
struct kthread *next = kthreadSelectNext();
|
||||
if (next == current)
|
||||
assert("cannot exit thread");
|
||||
currentThread = next;
|
||||
cpu_context_exit_to(next->cpuState, (cpu_kstate_function_arg1_t *)deleteKthread, (uint32_t)current);
|
||||
cpu_context_exit_to(next->cpuState, (cpu_kstate_function_arg1_t *)kthreadDelete, (uint32_t)current);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ int kthreadSetup(vaddr_t mainStack, size_t mainStackSize){
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct kthread *createKthread(const char *name, cpu_kstate_function_arg1_t func,
|
||||
struct kthread *kthreadCreate(const char *name, cpu_kstate_function_arg1_t func,
|
||||
void *args)
|
||||
{
|
||||
struct kthread *thread = (struct kthread *)malloc(sizeof(struct kthread));
|
||||
@ -48,7 +48,7 @@ struct kthread *createKthread(const char *name, cpu_kstate_function_arg1_t func,
|
||||
|
||||
if(cpu_kstate_init(&thread->cpuState, (cpu_kstate_function_arg1_t *)func, (vaddr_t)args,
|
||||
thread->stackAddr, thread->stackSize,
|
||||
(cpu_kstate_function_arg1_t *)kthread_exit, 0))
|
||||
(cpu_kstate_function_arg1_t *)kthreadExit, 0))
|
||||
goto free_mem;
|
||||
|
||||
list_add_tail(currentThread, thread);
|
||||
@ -59,21 +59,21 @@ free_mem:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void deleteKthread(struct kthread *thread){
|
||||
void kthreadDelete(struct kthread *thread){
|
||||
list_delete(currentThread, thread);
|
||||
|
||||
free((void *)thread->stackAddr);
|
||||
free((void *)thread);
|
||||
}
|
||||
|
||||
struct kthread *selectNextKthread(){
|
||||
struct kthread *kthreadSelectNext(){
|
||||
struct kthread *nextThread = currentThread->next;
|
||||
return nextThread;
|
||||
}
|
||||
|
||||
struct cpu_state *switchKthread(struct cpu_state *prevCpu){
|
||||
currentThread->cpuState = prevCpu;
|
||||
struct kthread *nextThread = selectNextKthread();
|
||||
struct kthread *nextThread = kthreadSelectNext();
|
||||
printStringDetails(nextThread->name, RED, BLACK, 40, VGA_HEIGHT - 1);
|
||||
currentThread = nextThread;
|
||||
return nextThread->cpuState;
|
||||
|
@ -17,12 +17,12 @@ struct kthread {
|
||||
|
||||
|
||||
int kthreadSetup(vaddr_t mainStack, size_t mainStackSize);
|
||||
void kthread_exit();
|
||||
void kthreadExit();
|
||||
|
||||
struct kthread *createKthread(const char *name, cpu_kstate_function_arg1_t func,
|
||||
struct kthread *kthreadCreate(const char *name, cpu_kstate_function_arg1_t func,
|
||||
void *args);
|
||||
|
||||
void deleteKthread(struct kthread *thread);
|
||||
void kthreadDelete(struct kthread *thread);
|
||||
|
||||
struct kthread *selectNextKthread();
|
||||
struct kthread *kthreadSelectNext();
|
||||
struct cpu_state *switchKthread(struct cpu_state *prevCpu);
|
||||
|
@ -119,7 +119,7 @@ void kmain(unsigned long magic, unsigned long addr)
|
||||
serialSetup(115200);
|
||||
allocInit();
|
||||
kthreadSetup(_stack_bottom, (_stack_top - _stack_bottom + 1));
|
||||
createKthread("idle", idleThread, NULL);
|
||||
kthreadCreate("idle", idleThread, NULL);
|
||||
irqSetRoutine(IRQ_TIMER, pit_handler);
|
||||
#ifdef RUN_TEST
|
||||
run_test();
|
||||
@ -128,5 +128,5 @@ void kmain(unsigned long magic, unsigned long addr)
|
||||
|
||||
// There is no real caller behind this point
|
||||
// So finish this by ourself
|
||||
kthread_exit();
|
||||
kthreadExit();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user