mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-31 14:38:21 +00:00
kernel: detach all event listener attachments
This commit is contained in:
@@ -16,18 +16,21 @@ typedef struct {
|
|||||||
#define EVENT_INITLISTENER(e) { \
|
#define EVENT_INITLISTENER(e) { \
|
||||||
poll_initdesc(&(e)->polldesc, 0); \
|
poll_initdesc(&(e)->polldesc, 0); \
|
||||||
(e)->polldesc.data = (e)->polldata; \
|
(e)->polldesc.data = (e)->polldata; \
|
||||||
|
(e)->polldesc.size = EVENT_MAX_ATTACHMENT; \
|
||||||
(e)->current = 0; \
|
(e)->current = 0; \
|
||||||
for (int i = 0; i < EVENT_MAX_ATTACHMENT; ++i) \
|
for (int i = 0; i < EVENT_MAX_ATTACHMENT; ++i) { \
|
||||||
(e)->polldata[i].desc = &(e)->polldesc; \
|
(e)->polldata[i].desc = &(e)->polldesc; \
|
||||||
|
(e)->polldata[i].header = NULL; \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define EVENT_ATTACH(e, h) { \
|
#define EVENT_ATTACH(e, h) { \
|
||||||
poll_add(h, &(e)->polldata[(e)->current++], POLLPRI); \
|
|
||||||
if ((e)->current >= EVENT_MAX_ATTACHMENT) { \
|
if ((e)->current >= EVENT_MAX_ATTACHMENT) { \
|
||||||
/* spin forever to say that there have been too many attachments */ \
|
/* spin forever to say that there have been too many attachments */ \
|
||||||
/* this should never happen normally and is meant as a way to alert whoever is programming about it */ \
|
/* this should never happen normally and is meant as a way to alert whoever is programming about it */ \
|
||||||
for (;;) asm volatile(""); \
|
for (;;) asm volatile(""); \
|
||||||
} \
|
} \
|
||||||
|
poll_add(h, &(e)->polldata[(e)->current++], POLLPRI); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define EVENT_WAIT(e, t) poll_dowait(&(e)->polldesc, t)
|
#define EVENT_WAIT(e, t) poll_dowait(&(e)->polldesc, t)
|
||||||
|
|||||||
Reference in New Issue
Block a user