weblink
weblink copied to clipboard
Change server update loop from NoWait to Default
Change reduces idle CPU usage by a large amount. (100% to 0%)
Needs testing.
I have confirmed only that POST and GET requests with plain text still work.
One issue is that LoopRunMode.Default prevents users from returning from the listen method (param blocking:Bool):
function main() {
new weblink.Weblink().listen(2000, false);
trace("hello!"); // isn't called with this patch
}
Also, because MainLoop/Thread.events are not integrated with the libuv loop, I do not expect any timers will be ran either.
One issue is that
LoopRunMode.Defaultprevents users from returning from thelistenmethod (paramblocking:Bool):function main() { new weblink.Weblink().listen(2000, false); trace("hello!"); // isn't called with this patch }Also, because MainLoop/Thread.events are not integrated with the libuv loop, I do not expect any timers will be ran either.
Maybe we could build out a system to run the timers using a background thread for the Haxe std. I know for example Heaps.io has to handle the haxe.Timer system as well as openFL instead of the std, where as targets such as JS work out of the box.