summaryrefslogtreecommitdiff
path: root/opendc-core/src/main
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2017-09-20 11:50:20 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2017-09-20 11:50:20 +0200
commit735d5543ed72f0c6cf632b35b3f23323cebcf81b (patch)
treeef4c9447a0574510fefdeebc81102237b876da3b /opendc-core/src/main
parentd21daac5bb79e975706c298cdec8060746eb813e (diff)
Allow suspendable processing of message envelopes
This change allows a process to suspend within a receive block.
Diffstat (limited to 'opendc-core/src/main')
-rw-r--r--opendc-core/src/main/kotlin/nl/atlarge/opendc/kernel/messaging/Readable.kt4
1 files changed, 2 insertions, 2 deletions
diff --git a/opendc-core/src/main/kotlin/nl/atlarge/opendc/kernel/messaging/Readable.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/kernel/messaging/Readable.kt
index 8faf17ab..398e9697 100644
--- a/opendc-core/src/main/kotlin/nl/atlarge/opendc/kernel/messaging/Readable.kt
+++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/kernel/messaging/Readable.kt
@@ -42,7 +42,7 @@ interface Readable {
* @param block The block to process the message with.
* @return The processed message.
*/
- suspend fun <T> receive(block: Envelope<*>.(Any) -> T): T
+ suspend fun <T> receive(block: suspend Envelope<*>.(Any) -> T): T
/**
* Retrieve and removes a single message from the entity's mailbox, suspending the function if the mailbox is empty.
@@ -55,7 +55,7 @@ interface Readable {
* @param block The block to process the message with.
* @return The processed message or `null` if the timeout was reached.
*/
- suspend fun <T> receive(timeout: Duration, block: Envelope<*>.(Any) -> T): T?
+ suspend fun <T> receive(timeout: Duration, block: suspend Envelope<*>.(Any) -> T): T?
/**
* Retrieve and removes a single message from the entity's mailbox, suspending the function until a message has