Skip to content

Commit d4484a0

Browse files
author
Vincent Rouillé
authored
Merge pull request #145 from Daniel-B-Smith/commit-send
Mark FdbFuture as Send + Sync
2 parents bb6f737 + 4544253 commit d4484a0

File tree

5 files changed

+12
-1
lines changed

5 files changed

+12
-1
lines changed

foundationdb-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ fdb-6_0 = [ ]
3030
[dependencies]
3131

3232
[build-dependencies]
33-
bindgen = "0.50"
33+
bindgen = "0.51"

foundationdb/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ byteorder = "1.2"
3939
log = "0.4"
4040
uuid = { version = "0.7", optional = true }
4141
rand = "0.7.0"
42+
static_assertions = "1.1"
4243

4344
[dev-dependencies]
4445
rand = "0.7"

foundationdb/src/future.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ impl futures::Future for FdbFuture {
8181
}
8282
}
8383

84+
unsafe impl Send for FdbFuture {}
85+
unsafe impl Sync for FdbFuture {}
86+
8487
// The callback from fdb C API can be called from multiple threads. so this callback should be
8588
// thread-safe.
8689
extern "C" fn fdb_future_callback(

foundationdb/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ extern crate futures;
121121
extern crate core;
122122
extern crate lazy_static;
123123
extern crate rand;
124+
#[macro_use]
125+
extern crate static_assertions;
124126
#[cfg(feature = "uuid")]
125127
extern crate uuid;
126128

foundationdb/src/transaction.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,3 +1038,8 @@ impl Future for TrxFuture {
10381038
}
10391039
}
10401040
}
1041+
1042+
#[allow(unused)]
1043+
fn test_futures_are_send_sync() {
1044+
assert_impl_all!(TrxCommit: Send, Sync);
1045+
}

0 commit comments

Comments
 (0)