File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,6 @@ fn test_varied_compression_ratios() {
90
90
#[ test]
91
91
#[ cfg( not( miri) ) ] // can't create threads
92
92
fn concurrent_tree_pops ( ) -> sled:: Result < ( ) > {
93
- use std:: convert:: TryInto ;
94
93
use std:: thread;
95
94
96
95
let db = sled:: open ( "db" ) ?;
@@ -100,13 +99,18 @@ fn concurrent_tree_pops() -> sled::Result<()> {
100
99
db. insert ( x. to_be_bytes ( ) , & [ ] ) ?;
101
100
}
102
101
102
+ let mut threads = vec ! [ ] ;
103
+
103
104
// Pop 5 values using multiple threads
104
105
for _ in 0 ..5 {
105
106
let db = db. clone ( ) ;
106
- thread:: spawn ( move || {
107
- let ( key, _) = db. pop_min ( ) . unwrap ( ) . unwrap ( ) ;
108
- let x = u32:: from_be_bytes ( ( & * key) . try_into ( ) . unwrap ( ) ) ;
109
- } ) ;
107
+ threads. push ( thread:: spawn ( move || {
108
+ db. pop_min ( ) . unwrap ( ) . unwrap ( ) ;
109
+ } ) ) ;
110
+ }
111
+
112
+ for thread in threads. into_iter ( ) {
113
+ thread. join ( ) . unwrap ( ) ;
110
114
}
111
115
112
116
assert ! (
You can’t perform that action at this time.
0 commit comments