File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -3,8 +3,9 @@ extern crate postgres;
33extern crate r2d2;
44extern crate r2d2_postgres;
55
6- use std:: sync:: { Arc , Future } ;
6+ use std:: sync:: Arc ;
77use std:: sync:: mpsc;
8+ use std:: thread:: Thread ;
89
910use postgres:: SslMode ;
1011use r2d2_postgres:: PostgresConnectionManager ;
@@ -20,23 +21,23 @@ fn test_basic() {
2021 let ( s2, r2) = mpsc:: channel ( ) ;
2122
2223 let pool1 = pool. clone ( ) ;
23- let mut fut1 = Future :: spawn ( move || {
24+ let t1 = Thread :: scoped ( move || {
2425 let conn = pool1. get ( ) . unwrap ( ) ;
2526 s1. send ( ( ) ) . unwrap ( ) ;
2627 r2. recv ( ) . unwrap ( ) ;
2728 drop ( conn) ;
2829 } ) ;
2930
3031 let pool2 = pool. clone ( ) ;
31- let mut fut2 = Future :: spawn ( move || {
32+ let t2 = Thread :: scoped ( move || {
3233 let conn = pool2. get ( ) . unwrap ( ) ;
3334 s2. send ( ( ) ) . unwrap ( ) ;
3435 r1. recv ( ) . unwrap ( ) ;
3536 drop ( conn) ;
3637 } ) ;
3738
38- fut1 . get ( ) ;
39- fut2 . get ( ) ;
39+ t1 . join ( ) . ok ( ) . unwrap ( ) ;
40+ t2 . join ( ) . ok ( ) . unwrap ( ) ;
4041
4142 pool. get ( ) . unwrap ( ) ;
4243}
You can’t perform that action at this time.
0 commit comments