Commit graph

30 commits

Author SHA1 Message Date
Sönke Ludwig b5ccb784a1 Allow Task.interrupt to be called within a yieldLock. 2019-01-22 18:06:55 +01:00
Sönke Ludwig 9b2aa13ef4 Fix possible infinite loop in TaskScheduler.process.
Fixes a discrepancy in TaskFiberQueue between empty and length, which causes process() to never return, thus processing events without timeout indefinitely.
2018-08-26 13:03:14 +02:00
Sönke Ludwig fd92a7f555 Fix Task.running and Task.yield directly after runTask/yieldLock.
The status of the task was erroneously reported as not running until the task was actually executed for the first time (which only happens after the yield lock has been lifted).
2018-04-08 01:30:43 +02:00
Sönke Ludwig 2653c8c5e0 Always remove task from queue when switching to it. Fixes #58.
Previously the task was only removed if switchTo was called from another task. Now it also gets removed when switchTo (e.g. due to a runTask() call) gets called form outside of a task.
2018-02-23 01:25:13 +01:00
Sönke Ludwig e4eaaddbba Make high-frequency log messages in the task scheduler optional.
Requires -debug=VibeTaskLog to enable them now.
2018-02-14 13:11:51 +01:00
Sönke Ludwig 874e174d38 Add const overload for Task.tid. 2017-10-24 09:44:54 +02:00
Sönke Ludwig 19db7732e6 Add nothrow annotations. 2017-07-20 13:36:27 +02:00
Sönke Ludwig bfc6b89ca4
Use abort() in case of uncaught Error exceptions.
Fixes "dwarfeh(224) fatal error" that are suspected to be related to occasional infinite loops.
2017-07-19 00:11:12 +02:00
Sönke Ludwig 4f69b1eaf3 Add setTaskCreationCallback() for better remote debugger integration. 2017-07-16 22:07:59 +02:00
Sönke Ludwig 719c62d6c9
Fix TLS initialization condition. 2017-07-16 00:08:07 +02:00
Sönke Ludwig 254d91dcdf
Improve error message. 2017-07-15 10:12:52 +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 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
Dentcho Bankov aef2936abd Fix for #11. Cross port of fix for #1742 from vibe.d 2017-04-15 00:04:08 +03:00
Sönke Ludwig 897c43051f
Fix nothrow inference for runTask. 2017-02-23 15:49:59 +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 db29e4730f Let uncaught errors in fibers terminate the process. 2017-02-16 11:56:04 +01:00
Sönke Ludwig b8663f9fbc
Conditionally compile TaskFiber.state.
See https://issues.dlang.org/show_bug.cgi?id=17131
2017-02-01 11:05:53 +01:00
Sönke Ludwig d0a55ef374
Add an uninterruptible variant of Task.join. 2017-01-29 20:20:08 +01:00
Sönke Ludwig 7803fdaa81 Make Task.interrupt nothrow + add diagnostic assertion. 2017-01-13 22:08:12 +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 0c3c31b969 Annotate more of Task/TaskLocal as safe. 2016-11-04 21:33:01 +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 e294d24a4b Update for latest eventcore version. 2016-10-05 14:40:29 +02:00
Sönke Ludwig 1005f5c674 Fix all ManualEvent related tests. 2016-06-17 22:33:04 +02:00
Sönke Ludwig f9579a5dd2 Various task scheduling fixes.
- the initial task yield() now is done in an uninterruptible way
- switchToTask now handles switching to an already scheduled task gracefully
- TaskScheduler.hibernate() now properly blocks when called form outside of a task
- added yieldUninterruptible()
2016-06-16 10:58:12 +02:00
Sönke Ludwig 3b0e4e0452 Big refactoring step.
- Moves a lot of stuff from vibe.core.core to vibe.core.task
- Introduces TaskScheduler to unify the scheduling process
- Refines how tasks are scheduled and processed (can push to the front of the task queue and uses a marker task to keep track of the spot up to which to process)
- Start to add proper support for task interrupts and timeouts by properly cancelling in-flight async operations
- Work on ManualEvent - still not functional for the shared case
- Implement proper IP address parsing in NetworkAddress
2016-06-14 08:01:03 +02:00
Sönke Ludwig 7e2d1dd038 Initial commit.
The library is able to support simple TCP servers in the current state. The API is still mostly compatible with mainline vibe.d, but the driver systen has been replaced by the eventcore library and sockets/files/timers/... are now structs with automatic reference counting instead of GC collected classes. The stream interfaces have been removed for now.
2016-03-01 20:30:42 +01:00