Fix OSX compiler errors

This commit is contained in:
Benjamin Schaaf 2019-01-15 21:32:36 +11:00
parent 7d091ed504
commit 6108a64973
2 changed files with 59 additions and 6 deletions

View file

@ -54,7 +54,8 @@ final class PosixEventDriver(Loop : PosixEventLoop) : EventDriver {
version (linux) alias WatcherDriver = InotifyEventDriverWatchers!EventsDriver; version (linux) alias WatcherDriver = InotifyEventDriverWatchers!EventsDriver;
//else version (OSX) alias WatcherDriver = FSEventsEventDriverWatchers!EventsDriver; //else version (OSX) alias WatcherDriver = FSEventsEventDriverWatchers!EventsDriver;
else alias WatcherDriver = PollEventDriverWatchers!EventsDriver; else alias WatcherDriver = PollEventDriverWatchers!EventsDriver;
alias ProcessDriver = SignalEventDriverProcesses!Loop; version (linux) alias ProcessDriver = SignalEventDriverProcesses!Loop;
else alias ProcessDriver = DummyEventDriverProcesses!Loop;
Loop m_loop; Loop m_loop;
CoreDriver m_core; CoreDriver m_core;

View file

@ -6,19 +6,18 @@ import eventcore.drivers.posix.driver;
import eventcore.drivers.posix.signals; import eventcore.drivers.posix.signals;
import eventcore.internal.utils : nogc_assert, print; import eventcore.internal.utils : nogc_assert, print;
import std.algorithm.comparison : among;
import std.variant : visit;
import core.stdc.errno : errno, EAGAIN, EINPROGRESS; import core.stdc.errno : errno, EAGAIN, EINPROGRESS;
import core.sys.linux.sys.signalfd;
import core.sys.posix.signal; import core.sys.posix.signal;
import core.sys.posix.unistd : close, read, write, dup; import core.sys.posix.unistd : close, read, write, dup;
import std.algorithm.comparison : among;
import std.variant : visit;
private enum SIGCHLD = 17; private enum SIGCHLD = 17;
final class SignalEventDriverProcesses(Loop : PosixEventLoop) : EventDriverProcesses { final class SignalEventDriverProcesses(Loop : PosixEventLoop) : EventDriverProcesses {
@safe: /*@nogc:*/ nothrow: @safe: /*@nogc:*/ nothrow:
import core.sys.linux.sys.signalfd;
private { private {
static struct ProcessInfo { static struct ProcessInfo {
@ -290,3 +289,56 @@ final class SignalEventDriverProcesses(Loop : PosixEventLoop) : EventDriverProce
return info.userData.ptr; return info.userData.ptr;
} }
} }
final class DummyEventDriverProcesses(Loop : PosixEventLoop) : EventDriverProcesses {
@safe: /*@nogc:*/ nothrow:
this(Loop loop, EventDriverPipes pipes) {}
void dispose() {}
override ProcessID adopt(int system_pid)
{
assert(false, "TODO!");
}
override Process spawn(string[] args, ProcessStdinFile stdin, ProcessStdoutFile stdout, ProcessStderrFile stderr, const string[string] env, ProcessConfig config, string working_dir)
{
assert(false, "TODO!");
}
override bool hasExited(ProcessID pid)
{
assert(false, "TODO!");
}
override void kill(ProcessID pid, int signal)
{
assert(false, "TODO!");
}
override size_t wait(ProcessID pid, ProcessWaitCallback on_process_exit)
{
assert(false, "TODO!");
}
override void cancelWait(ProcessID pid, size_t waitId)
{
assert(false, "TODO!");
}
override void addRef(ProcessID pid)
{
assert(false, "TODO!");
}
override bool releaseRef(ProcessID pid)
{
assert(false, "TODO!");
}
protected override void* rawUserData(ProcessID descriptor, size_t size, DataInitializer initialize, DataInitializer destroy)
@system {
assert(false, "TODO!");
}
}