From df82b1e819dc75f0de85eb29e374b665e971bb56 Mon Sep 17 00:00:00 2001 From: Daniel Sanchez Quiros Date: Wed, 5 Oct 2022 16:40:26 +0200 Subject: [PATCH] Implement send + sync for the node handle --- waku/src/node/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/waku/src/node/mod.rs b/waku/src/node/mod.rs index 45145f7..6fed63a 100644 --- a/waku/src/node/mod.rs +++ b/waku/src/node/mod.rs @@ -35,6 +35,12 @@ impl WakuNodeState for Running {} pub struct WakuNodeHandle(PhantomData); +/// We do not have any inner state, so the handle should be safe to be send among threads. +unsafe impl Send for WakuNodeHandle {} +/// References to the handle are safe to share, as they do not mutate the handle itself and +/// operations are performed by the bindings backend, which is supposed to be thread safe. +unsafe impl Sync for WakuNodeHandle {} + impl WakuNodeHandle { /// If the execution is successful, the result is the peer ID as a string (base58 encoded) ///