Allow to inherit from the kqueue loop implementation.
This commit is contained in:
parent
aa3659fca6
commit
4b1afa8d6c
|
@ -31,8 +31,16 @@ import core.sys.linux.epoll;
|
||||||
|
|
||||||
alias KqueueEventDriver = PosixEventDriver!KqueueEventLoop;
|
alias KqueueEventDriver = PosixEventDriver!KqueueEventLoop;
|
||||||
|
|
||||||
final class KqueueEventLoop : PosixEventLoop {
|
final class KqueueEventLoop : KqueueEventLoopBase {
|
||||||
private {
|
override bool doProcessEvents(Duration timeout)
|
||||||
|
@trusted {
|
||||||
|
return doProcessEventsBase(timeout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
abstract class KqueueEventLoopBase : PosixEventLoop {
|
||||||
|
protected {
|
||||||
int m_queue;
|
int m_queue;
|
||||||
size_t m_changeCount = 0;
|
size_t m_changeCount = 0;
|
||||||
kevent_t[100] m_changes;
|
kevent_t[100] m_changes;
|
||||||
|
@ -45,8 +53,8 @@ final class KqueueEventLoop : PosixEventLoop {
|
||||||
assert(m_queue >= 0, "Failed to create kqueue.");
|
assert(m_queue >= 0, "Failed to create kqueue.");
|
||||||
}
|
}
|
||||||
|
|
||||||
override bool doProcessEvents(Duration timeout)
|
protected bool doProcessEventsBase(Duration timeout)
|
||||||
@trusted {
|
@trusted nothrow {
|
||||||
import std.algorithm : min;
|
import std.algorithm : min;
|
||||||
//assert(Fiber.getThis() is null, "processEvents may not be called from within a fiber!");
|
//assert(Fiber.getThis() is null, "processEvents may not be called from within a fiber!");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue