Update for eventcore 0.5.0 and the latest DMD beta.
This commit is contained in:
parent
d7243dcd39
commit
c08f101549
8 changed files with 32 additions and 210 deletions
|
@ -627,10 +627,10 @@ private TaskFuncInfo makeTaskFuncInfo(CALLABLE, ARGS...)(ref CALLABLE callable,
|
|||
mixin(callWithMove!ARGS("c", "args.expand"));
|
||||
}
|
||||
|
||||
TaskFuncInfo tfi;
|
||||
tfi.func = &callDelegate;
|
||||
return () @trusted {
|
||||
TaskFuncInfo tfi;
|
||||
tfi.func = &callDelegate;
|
||||
|
||||
() @trusted {
|
||||
static if (hasElaborateAssign!CALLABLE) tfi.initCallable!CALLABLE();
|
||||
static if (hasElaborateAssign!TARGS) tfi.initArgs!TARGS();
|
||||
tfi.typedCallable!CALLABLE = callable;
|
||||
|
@ -638,8 +638,8 @@ private TaskFuncInfo makeTaskFuncInfo(CALLABLE, ARGS...)(ref CALLABLE callable,
|
|||
static if (needsMove!A) args[i].move(tfi.typedArgs!TARGS.expand[i]);
|
||||
else tfi.typedArgs!TARGS.expand[i] = args[i];
|
||||
}
|
||||
return tfi;
|
||||
} ();
|
||||
return tfi;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1094,7 +1094,7 @@ struct Timer {
|
|||
if (!this.pending) return;
|
||||
asyncAwait!(TimerCallback,
|
||||
cb => m_driver.wait(m_id, cb),
|
||||
cb => m_driver.cancelWait(m_id, cb)
|
||||
cb => m_driver.cancelWait(m_id)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1360,7 +1360,7 @@ private void shutdownDriver()
|
|||
ManualEvent.ms_threadEvent = EventID.init;
|
||||
}
|
||||
|
||||
eventDriver.core.dispose();
|
||||
eventDriver.dispose();
|
||||
}
|
||||
|
||||
private void workerThreadFunc()
|
||||
|
|
|
@ -321,7 +321,7 @@ struct TCPConnection {
|
|||
private this(StreamSocketFD socket)
|
||||
nothrow {
|
||||
m_socket = socket;
|
||||
m_context = &eventDriver.core.userData!Context(socket);
|
||||
m_context = () @trusted { return &eventDriver.core.userData!Context(socket); } ();
|
||||
m_context.readBuffer.capacity = 4096;
|
||||
}
|
||||
|
||||
|
@ -360,7 +360,7 @@ struct TCPConnection {
|
|||
nothrow {
|
||||
//logInfo("close %s", cast(int)m_fd);
|
||||
if (m_socket != StreamSocketFD.invalid) {
|
||||
eventDriver.sockets.shutdown(m_socket);
|
||||
eventDriver.sockets.shutdown(m_socket, true, true);
|
||||
eventDriver.sockets.releaseRef(m_socket);
|
||||
m_socket = StreamSocketFD.invalid;
|
||||
m_context = null;
|
||||
|
|
|
@ -323,7 +323,7 @@ final package class TaskFiber : Fiber {
|
|||
private void run()
|
||||
{
|
||||
import std.encoding : sanitize;
|
||||
import std.concurrency : Tid;
|
||||
import std.concurrency : Tid, thisTid;
|
||||
import vibe.core.core : isEventLoopRunning, recycleFiber, taskScheduler, yield;
|
||||
|
||||
version (VibeDebugCatchAll) alias UncaughtException = Throwable;
|
||||
|
@ -346,12 +346,12 @@ final package class TaskFiber : Fiber {
|
|||
m_running = true;
|
||||
scope(exit) m_running = false;
|
||||
|
||||
std.concurrency.thisTid; // force creation of a message box
|
||||
thisTid; // force creation of a message box
|
||||
|
||||
debug if (ms_taskEventCallback) ms_taskEventCallback(TaskEvent.start, handle);
|
||||
if (!isEventLoopRunning) {
|
||||
logTrace("Event loop not running at task start - yielding.");
|
||||
vibe.core.core.taskScheduler.yieldUninterruptible();
|
||||
taskScheduler.yieldUninterruptible();
|
||||
logTrace("Initial resume of task.");
|
||||
}
|
||||
task.func(&task);
|
||||
|
@ -597,7 +597,7 @@ package struct TaskScheduler {
|
|||
// if the first run didn't process any events, block and
|
||||
// process one chunk
|
||||
logTrace("Wait for new events to process...");
|
||||
er = eventDriver.core.processEvents();
|
||||
er = eventDriver.core.processEvents(Duration.max);
|
||||
logTrace("Done.");
|
||||
final switch (er) {
|
||||
case ExitReason.exited: return ExitReason.exited;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue