event loop wtf it didnt commit i hate git

This commit is contained in:
Adam D. Ruppe 2023-12-29 12:02:06 -05:00
parent 73d4cf9c12
commit 15a29d49dd
2 changed files with 8 additions and 7 deletions

13
core.d
View File

@ -2041,7 +2041,8 @@ interface ICoreEventLoop {
enum Possibilities { enum Possibilities {
CarryOn, CarryOn,
LocalExit, LocalExit,
GlobalExit GlobalExit,
Interrupted
} }
Possibilities result; Possibilities result;
@ -4829,7 +4830,7 @@ version(HasThread) struct ArsdCoreApplication {
private class CoreEventLoopImplementation : ICoreEventLoop { private class CoreEventLoopImplementation : ICoreEventLoop {
version(EmptyEventLoop) RunOnceResult runOnce(Duration timeout = Duration.max) { return RunOnceResult.Possibilities.LocalExit; } version(EmptyEventLoop) RunOnceResult runOnce(Duration timeout = Duration.max) { return RunOnceResult(RunOnceResult.Possibilities.LocalExit); }
version(EmptyCoreEvent) version(EmptyCoreEvent)
{ {
UnregisterToken addCallbackOnFdReadable(int fd, CallbackHelper cb){return typeof(return).init;} UnregisterToken addCallbackOnFdReadable(int fd, CallbackHelper cb){return typeof(return).init;}
@ -4885,7 +4886,7 @@ private class CoreEventLoopImplementation : ICoreEventLoop {
runLoopIterationDelegates(); runLoopIterationDelegates();
return RunOnceResult.Possibilities.CarryOn; return RunOnceResult(RunOnceResult.Possibilities.CarryOn);
} }
// FIXME: idk how to make one event that multiple kqueues can listen to w/o being shared // FIXME: idk how to make one event that multiple kqueues can listen to w/o being shared
@ -5081,7 +5082,7 @@ private class CoreEventLoopImplementation : ICoreEventLoop {
runLoopIterationDelegates(); runLoopIterationDelegates();
return RunOnceResult.Possibilities.CarryOn; return RunOnceResult(RunOnceResult.Possibilities.CarryOn);
} }
} }
@ -5369,7 +5370,7 @@ private class CoreEventLoopImplementation : ICoreEventLoop {
if(ret == -1) { if(ret == -1) {
import core.stdc.errno; import core.stdc.errno;
if(errno == EINTR) { if(errno == EINTR) {
return; return RunOnceResult(RunOnceResult.Possibilities.Interrupted);
} }
throw new ErrnoApiException("epoll_wait", errno); throw new ErrnoApiException("epoll_wait", errno);
} else if(ret == 0) { } else if(ret == 0) {
@ -5389,7 +5390,7 @@ private class CoreEventLoopImplementation : ICoreEventLoop {
runLoopIterationDelegates(); runLoopIterationDelegates();
return RunOnceResult.Possibilities.CarryOn; return RunOnceResult(RunOnceResult.Possibilities.CarryOn);
} }
// building blocks for low-level integration with the loop // building blocks for low-level integration with the loop

View File

@ -271,7 +271,7 @@ DirFlag dirFlag(Dir dir) {
// this is public but like i don't want do document it since it can so easily fail the asserts. // this is public but like i don't want do document it since it can so easily fail the asserts.
DirFlag dirFlag(Point dir) { DirFlag dirFlag(Point dir) {
return dirFlag(cast(Dir) dir); return dirFlag(*cast(Dir*) &dir);
} }
/++ /++