void block_process_in_kernel(int pid) { processNode * aux; timeslot = 1; if(ready == NULL) { _yield(); return; } aux = ((processNode*)ready); if(aux->process->pid == pid) { aux->process->state = BLOCKED; }else{ while(aux->next != NULL && ((processNode*)aux->next)->process->pid != pid) aux = ((processNode*)aux->next); if(aux->next == NULL) { _yield(); return; } ((processNode*)aux->next)->process->state = BLOCKED; } _yield(); return; }
qword sys_leave(qword rsi, qword rdx, qword rcx, qword r8, qword r9) { if (getForegroundPid() == getCurrentPid()) { setForeground(1); // give forground to shell } changeProcessState(getCurrentPid(), DEAD); _yield(); return 0; }
uint64_t coroutine_sleep(uint64_t msecs) { struct coroutine *co = _running_coroutine(); co->status = STATUS_ASYNC; if (msecs == 0) { co->status = STATUS_QUEUE; _queue(co->sched, co); } // FIXME insert co to sleeping queue, wait for wakeup. return (uint64_t)(uintptr_t)_yield(co); }
qword sys_yield(qword rsi, qword rdx, qword rcx, qword r8, qword r9) { _yield(); return 0; }
void * coroutine_yield() { struct coroutine *co = _running_coroutine(); co->status = STATUS_QUEUE; return _yield(co); }
void coroutine_exit() { struct coroutine *co = _running_coroutine(); co->status = STATUS_EXITING; _yield(co); }
void yield_send(T data) { _has_data = true; _data = data; _yield(); }
void yield() { _has_data = false; _yield(); }
void yield() { _yield(); }
/** yield **/ bool Coroutine::yield(Object* yield_param){ return _yield(yield_param, STATUS_WAITING); }
/* Yield current thread */ void _ThreadYield(void) { /* Call the extern */ _yield(); }