mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 06:58:22 +00:00
events: finish implementation
This commit is contained in:
+2
-2
@@ -49,7 +49,7 @@ int event_wait(event_t* event, bool interruptible){
|
|||||||
addtoevent(thread, event);
|
addtoevent(thread, event);
|
||||||
|
|
||||||
|
|
||||||
// ...
|
sched_block(interruptible);
|
||||||
|
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@@ -87,7 +87,7 @@ int event_signal(event_t* event, bool interruptson){
|
|||||||
if(!thread)
|
if(!thread)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// ...
|
sched_eventsignal(event, thread);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -296,10 +296,6 @@ void sched_eventsignal(event_t* event, thread_t* thread){
|
|||||||
void sched_block(bool interruptible){
|
void sched_block(bool interruptible){
|
||||||
|
|
||||||
thread_t* thread = arch_getcls()->thread;
|
thread_t* thread = arch_getcls()->thread;
|
||||||
|
|
||||||
spinlock_acquire(&queues[thread->priority].lock);
|
|
||||||
queue_remove(&queues[thread->priority], thread);
|
|
||||||
spinlock_release(&queues[thread->priority].lock);
|
|
||||||
|
|
||||||
thread->state = interruptible ? THREAD_STATE_BLOCKED_INTR : THREAD_STATE_BLOCKED;
|
thread->state = interruptible ? THREAD_STATE_BLOCKED_INTR : THREAD_STATE_BLOCKED;
|
||||||
|
|
||||||
@@ -314,7 +310,6 @@ void sched_init(){
|
|||||||
timer_req* req = &arch_getcls()->schedreq;
|
timer_req* req = &arch_getcls()->schedreq;
|
||||||
|
|
||||||
req->func = sched_timerhook;
|
req->func = sched_timerhook;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void sched_runinit(){
|
void sched_runinit(){
|
||||||
|
|||||||
Reference in New Issue
Block a user