Beispiel #1
0
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;
}
Beispiel #2
0
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;
}
Beispiel #3
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);
}
Beispiel #4
0
qword sys_yield(qword rsi, qword rdx, qword rcx, qword r8, qword r9) {
    _yield();
    return 0;
}
Beispiel #5
0
void *
coroutine_yield() {
    struct coroutine *co = _running_coroutine();
    co->status = STATUS_QUEUE;
    return _yield(co);
}
Beispiel #6
0
void
coroutine_exit() {
    struct coroutine *co = _running_coroutine();
    co->status = STATUS_EXITING;
    _yield(co);
}
Beispiel #7
0
 void yield_send(T data) {
     _has_data = true;
     _data     = data;
     _yield();
 }
Beispiel #8
0
 void yield() {
     _has_data = false;
     _yield();
 }
Beispiel #9
0
 void yield() {
     _yield();
 }
Beispiel #10
0
	/** yield **/
	bool Coroutine::yield(Object* yield_param){
		return _yield(yield_param, STATUS_WAITING);
	}
Beispiel #11
0
/* Yield current thread */
void _ThreadYield(void)
{
	/* Call the extern */
	_yield();
}