Commit graph

13 commits

Author SHA1 Message Date
Sönke Ludwig b6ed92e8b5 Introduce ChannelConfig/ChannelPriority.
Adds a low-overhead mode to Channel!T that causes the buffer to be fully processed before notifying waiting peers instead of notifying immediately once data/space is available. This heavily reduces the overhead of cross-task/thread notifications at the expense of introducing processing latency and requiring a call to close() to guarantee that all data has been processed.
2021-01-12 10:55:12 +01:00
Geod24 bccd494072 Replace 'body' with 'do' 2020-04-17 01:29:16 +09:00
Sönke Ludwig 8e24c4a204 Correct copyright holder.
rejectedsoftware e.K. doesn't exist anymore since mid-2019.
2020-01-27 19:20:52 +01:00
Sönke Ludwig 37ad77c701 Let empty block to make sure the following consumeOne succeeds.
This change ensures that a return value of false guarantees the next call to consumeOne to succeed, meaning that the combination of empty/consumeOne is sound in a single-consumer scenario. This also updates the documentation to stress that tryConsumeOne is still the preferred API.
2019-06-16 23:00:05 +02:00
Sönke Ludwig 02f5b4f91d Avoid superfluous notifyAll calls in Channel.
Slightly reduces the notification overhead in multiple-reader or multiple-writer scenarios.
2019-03-10 16:00:12 +01:00
Sönke Ludwig 92bb067f4b Make Channel.tryConsumeOne/consumeAll/close/empty/bufferFill nothrow. 2019-01-26 18:29:28 +01:00
Sönke Ludwig c6a29e1c3b Make createChannel safe and add Channel.bufferFill. 2019-01-26 18:04:50 +01:00
Sönke Ludwig 857be9459e Improve convenience of the Channel API.
- allows all methods to be called on a `shared(Channel!T)` instance.
- `Channel` pre-defines the `buffer_size` argument to 100, matching `createChannel`
2019-01-22 10:50:46 +01:00
Sönke Ludwig 3503001ec6 Add contract to Channel.consumeAll to force the input buffer to be empty. 2019-01-20 14:31:29 +01:00
Sönke Ludwig 3be1de2fdb Refine the semantics of consumeAll. 2019-01-20 11:57:16 +01:00
Sönke Ludwig f31db98144 Add documentation, basic unit test, createChannel(), close() and tryConsumeOne(). 2019-01-14 22:16:45 +01:00
Sönke Ludwig 82936041e4 Add some more notes. 2019-01-14 20:42:31 +01:00
Sönke Ludwig bce39e512c Implement a simple thread-safe cross-task channel. 2019-01-14 20:42:31 +01:00