summaryrefslogtreecommitdiff
path: root/src/channel.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/channel.rs')
-rw-r--r--src/channel.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/channel.rs b/src/channel.rs
index 1169a65..82ac981 100644
--- a/src/channel.rs
+++ b/src/channel.rs
@@ -14,6 +14,12 @@ struct ChannelInner {
read_limit: Mutex<Option<u64>>,
}
+// ChannelInner is both Send and Sync; the compiler can't see it because it
+// is pessimistic about the raw pointer. We use Arc/Mutex to guard accessing
+// the raw pointer so we are safe for both.
+unsafe impl Send for ChannelInner {}
+unsafe impl Sync for ChannelInner {}
+
struct LockedChannel<'a> {
raw: *mut raw::LIBSSH2_CHANNEL,
sess: MutexGuard<'a, SessionInner>,