Commit graph

15 commits

Author SHA1 Message Date
Sönke Ludwig 5640516ba8 Remove SpinLock and use core.sync.mutex.Mutex instead.
The places that used it showed too much contention in load tests, so that the spin lock was more expensive that the regular OS mutex/futex.
2019-09-19 11:25:14 +02:00
Sönke Ludwig 4f5636dadf Mark async/Future and runWorkerTaskH as safe. 2019-08-21 13:34:00 +02:00
Sönke Ludwig a54fa6b7de Implement runWorkerTaskDistH.
Variant of runWorkerTask that allows to get the handles of the created tasks.
2019-01-26 18:02:47 +01:00
Sönke Ludwig dfd7d97225 Fix parameter documentation syntax. Fixes #103. 2019-01-14 10:22:13 +01:00
Sönke Ludwig 6caff0b105 Fix synchronization and shutdown issues in TaskPool.
- terminate() would hang if called from a worker thread because it would attempt to self-join
- the handleWorkerTasks could miss signal emits, resulting in a hanging task queue or a missed termination signal
2018-10-27 00:42:06 +02:00
Sönke Ludwig 849bca4855 Avoid starting an explicit event loop in worker threads.
This reduces the overhead of task pool threads slightly and simplifies stack traces in case of errors.
2018-10-23 11:27:28 +02:00
Sönke Ludwig 7703cc675f Fix a race-condition in TaskPool.
The lock that should surround the foreach loop was given up prematurely.
2018-03-07 10:39:28 +01:00
Sönke Ludwig 0dbebac482 Add TaskPool.threadCount property. 2017-09-21 13:38:24 +02:00
Sönke Ludwig a60828d6da Mark more classes as final. 2017-07-23 15:04:11 +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 0895cd1960
Avoid bogus assertion failure.
Since the task queue entries never got cleaned up, the assertion got triggered once already used queue slots were starting to get reused.
2017-03-27 16:31:52 +02:00
Sönke Ludwig b995bdaa72
Use thread wait primitives for worker thread shutdown.
Avoids possible issues due to tasks interleaving the shutdown on the same thread.
2017-02-23 14:43:22 +01:00
Sönke Ludwig 76882b3bd7 Remove temporary debug log messages. 2017-02-22 19:58:11 +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