From 735d5543ed72f0c6cf632b35b3f23323cebcf81b Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Wed, 20 Sep 2017 11:50:20 +0200 Subject: Allow suspendable processing of message envelopes This change allows a process to suspend within a receive block. --- .../src/main/kotlin/nl/atlarge/opendc/kernel/messaging/Readable.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'opendc-core') 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 receive(block: Envelope<*>.(Any) -> T): T + suspend fun 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 receive(timeout: Duration, block: Envelope<*>.(Any) -> T): T? + suspend fun 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 -- cgit v1.2.3