Commit graph

57 commits

Author SHA1 Message Date
Sönke Ludwig eb3620056f Ensure async lambdas are templates to fix LDC linker errors. Fixes #65.
If the lambda is a concrete function, two different versions will end up for it in the final binary on macOS when compiled with LDC. Using argument inference works around that issue.
2018-03-08 14:24:22 +01:00
Sönke Ludwig 66c9aeea57 Don't exit event loop prematurely. Fixes #66.
Idle processing needs to check whether there are still tasks scheduled to be resumed before setting the exit flag when there are no more waiters (I/O etc.).
2018-03-06 23:41:56 +01:00
Sönke Ludwig 595beb2c60 Bump version number. 2018-02-26 20:40:28 +01:00
Sönke Ludwig d2146e3881 Fix shutdown of the worker thread pool.
Shuts down the pool before terminating the threads to avoid accessing an event thread waiter slot that is not associated with a valid eventcore driver anymore.
2018-02-22 20:10:08 +01:00
Sönke Ludwig 1ed1c85f76 Use std.parallelism.totalCPUs to implement logicalProcessorCount.
See vibe-d/vibe.d#2008.
2018-01-10 18:28:26 +01:00
Sönke Ludwig 8c68a4aeef Bump version number. 2017-11-17 11:56:59 +01:00
Sönke Ludwig 9fe9783443 Convert Waitable from struct to pure template to avoid heap closures.
Also fixes a case where ThreadLocalWaiter.emitSingle overlaps a call to .emit.
2017-09-27 16:41:11 +02:00
Sönke Ludwig a93b6e1cb1 Move log message to print before shutdown to avoid potential mixup with other log messages during shutdown. 2017-09-21 14:35:53 +02:00
Sönke Ludwig a5628230c1 Fix setupWorkerThreads to actually use the provided thread count. See #35. 2017-09-21 13:40:00 +02:00
Sönke Ludwig dd05676c4e Fix workerThreadCount to return the actual number of threads in the default worker pool. Fixes #35. 2017-09-21 13:39:05 +02:00
Sönke Ludwig cf914d8827 Update version. 2017-09-05 16:05:06 +02:00
Sönke Ludwig 1ef8d5206f
Fix handling of the "periodic" argument to the setTimer compatibility overload. 2017-09-03 15:46:50 +02:00
Sönke Ludwig 544157c065
Fix return value for FileDescriptorEvent.wait. 2017-08-14 14:27:09 +02:00
Sönke Ludwig 62ee67091d
Enable support for timeouts in FileDescriptorEvent.wait. 2017-08-13 23:35:11 +02:00
Sönke Ludwig 2777b0a6ff
Fix FileDescriptorEvent constructor to adhere to the given event mask. 2017-07-29 13:32:27 +02:00
Sönke Ludwig 2ba6c2eca1
Bump version number. 2017-07-20 18:50:40 +02:00
Sönke Ludwig fcf98c2016 Merge branch 'master' into trailing-whitespace 2017-07-19 00:08:33 +02:00
Sönke Ludwig e3492bab06 Update change log and bump version number. 2017-07-16 22:29:45 +02:00
Sönke Ludwig 4f69b1eaf3 Add setTaskCreationCallback() for better remote debugger integration. 2017-07-16 22:07:59 +02:00
Sönke Ludwig 87296bb1e4 Fix compilation error for VibeIdleCollect. 2017-07-10 19:46:16 +02:00
Sebastian Wilzbach 8f89733a86 Remove all trailing whitespace
sed 's/[ \t]*$//' -i **/*.d
2017-07-03 12:19:27 +02:00
Sebastian Wilzbach 04b3575c14 Remove deprecated stdc import 2017-07-03 00:39:41 +02:00
Sönke Ludwig fd93ab82f5
Remove deprecation attribute for the system overload of setTimer.
The approach for now is to keep overloads that receive system delegates and are also marked system in turn. This breaks safety promises in some places within the library, but is an acceptable first step that keeps other possible directions open.
2017-06-22 09:38:56 +02:00
Sönke Ludwig f40da06385
Update version number. 2017-06-22 09:36:49 +02:00
Sönke Ludwig bc689489a8
Add yieldLock(), which enables enforcing no task switches within a scope.
runTask() was altered to delay the task switch in case it gets called within an active yieldLock(), so that running tasks is still possible.
2017-06-11 11:40:25 +02:00
Sönke Ludwig 698824e811
Partially implement FileDescriptorStream.
Currently only works for waiting on read-readiness (eventcore is not exposing an analog function for write-readiness).
2017-05-30 11:02:22 +02:00
Sönke Ludwig 99a5b882d8
Limit the number of recycled fibers.
This allows the process to free up memory after heavy load spikes, while not impacting performance negatively.
2017-05-30 11:00:37 +02:00
Sönke Ludwig de718c4b1c
Add runTask overloads to make lambda argument inference work. 2017-02-23 16:39:42 +01:00
Sönke Ludwig 897c43051f
Fix nothrow inference for runTask. 2017-02-23 15:49:59 +01:00
Sönke Ludwig 3dbdc90927
Fix shutdown when no worker tasks have been used. 2017-02-22 23:26:16 +01:00
Sönke Ludwig 9ac908c599 Use a ring buffer for worker tasks and make TaskFuncInfo creation slightly more efficient. 2017-02-22 19:52:22 +01:00
Sönke Ludwig 40713db075 Move worker task logic into a new TaskPool class. 2017-02-22 18:35:51 +01:00
Sönke Ludwig d9c373419a
Fixup for the previous timer fix. 2017-01-30 20:12:37 +01:00
Sönke Ludwig f5c2177c5d
Fix createTimer() when called with a callback. 2017-01-30 19:55:34 +01:00
Sönke Ludwig c490a354b7
Handle Timer.stop() gracefully for null timers. 2017-01-30 17:34:25 +01:00
Sönke Ludwig 2ff37202c0
Add compatibility overload for setTimer(). 2017-01-29 16:46:21 +01:00
Sönke Ludwig fc96ee9050
Fixes for setTimer and SpinLock.
- setTimer now starts a task to call the callback. This keeps the timer referenced and avoids issues if I/O functions are called from within the callback.
- SpinLock is now also initialized in "shared static this", so that applications using "shared static this" for initialization work properly.
2017-01-27 22:50:29 +01:00
Sönke Ludwig fdfbb55aa8 Re-implement ManualEvent.
This simplifies the logic by separating thread local notifications from cross-thread notifications, as well as replacing lockless operations by a spin lock. The thread local variant of ManualEvent is now also separated into a LocalManualEvent type.
2017-01-13 22:24:18 +01:00
Sönke Ludwig e28c6950d7 Fix shutdown behavior.
- Detection of the main thread contained a race condition
- The exit flag monitor task that is started for each event loop wasn't shut down, so that many could be running if runEventLoop was called multiple times.
2017-01-13 22:11:59 +01:00
Sönke Ludwig 8c0660781d Thread safety improvements in the task system.
Removes some invalid safety annotations and adds a workaround for a starvation issue in Task.join() across threads boundaries. This is still not thread-safe, but now has a safety-net and is documented, so that it doesn't get lost.
2016-12-19 20:24:08 +01:00
Sönke Ludwig bf2edc7fb2 Fix TaskScheduler.waitAndProcess to not block if any tasks were resumed.
In situations where no events were involved in an multi-task scenario, the old behavior could lead to the process to starve or hang until an event arrived.
2016-12-10 14:13:44 +01:00
Sönke Ludwig 942089a91c Add unit tests for joinding tasks from outside of another task. 2016-11-29 19:17:14 +01:00
Sönke Ludwig c08f101549 Update for eventcore 0.5.0 and the latest DMD beta. 2016-10-24 08:22:49 +02:00
Sönke Ludwig 1337715b2d Remove unused code. 2016-10-06 22:05:07 +02:00
Sönke Ludwig e294d24a4b Update for latest eventcore version. 2016-10-05 14:40:29 +02:00
Sönke Ludwig 930ba5c3de Fix safety annotation issues. 2016-10-04 17:51:49 +02:00
Sönke Ludwig 19f796af9f Add vibe.core.runApplication. See rejectedsoftware/vibe.d#1417. 2016-08-30 12:30:49 +02:00
Sönke Ludwig 1005f5c674 Fix all ManualEvent related tests. 2016-06-17 22:33:04 +02:00
Sönke Ludwig ed36531bd2 Add runEventLoopOnce() and fix hibernate() to block outside of a task. 2016-06-16 10:44:55 +02:00
Sönke Ludwig 8264070f19 Fix for latest eventcore changes. 2016-06-14 09:25:28 +02:00