From 903a081b61425bc07c9a7ddccc9cbe5d4a59ac76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Em=C4=ABls?= Date: Wed, 18 Dec 2024 17:44:16 +0100 Subject: [PATCH] Document async channel a bit --- ios/MullvadTypes/Promise.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ios/MullvadTypes/Promise.swift b/ios/MullvadTypes/Promise.swift index 88b697510aff..ab80c316954b 100644 --- a/ios/MullvadTypes/Promise.swift +++ b/ios/MullvadTypes/Promise.swift @@ -48,6 +48,10 @@ public final class Promise { } } +// This object can be used like an async semaphore with exactly 1 writer. It +// allows the waiter to wait to `receive()` from another operation +// asynchronously. It is important not to forget to call `send`, otherwise this +// operation will block indefinitely. public struct OneshotChannel { private var continuation: AsyncStream.Continuation? private var stream: AsyncStream