mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 09:47:44 +00:00
hv: sched: simple event implemention
This simple event implemention can only support exclusive waiting at same time. It mainly used by thread who want to wait for special event happens. Thread A who want to wait for some events calls wait_event(struct sched_event *); Thread B who can give the event signal calls signal_event(struct sched_event *); Tracked-On: #4329 Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
16
hypervisor/include/common/event.h
Normal file
16
hypervisor/include/common/event.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef EVENT_H
|
||||
#define EVENT_H
|
||||
#include <spinlock.h>
|
||||
|
||||
struct sched_event {
|
||||
spinlock_t lock;
|
||||
bool set;
|
||||
struct thread_object* waiting_thread;
|
||||
};
|
||||
|
||||
void init_event(struct sched_event *event);
|
||||
void reset_event(struct sched_event *event);
|
||||
void wait_event(struct sched_event *event);
|
||||
void signal_event(struct sched_event *event);
|
||||
|
||||
#endif /* EVENT_H */
|
Reference in New Issue
Block a user