File tree Expand file tree Collapse file tree 4 files changed +10
-6
lines changed Expand file tree Collapse file tree 4 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 8
8
int triple(int x);
9
9
""" )
10
10
11
- C = ffi .dlopen ("target/debug/libburn-c21ba537b4f26cae .dylib" )
11
+ C = ffi .dlopen ("target/debug/libburn.dylib" )
12
12
13
13
print (C .triple (3 ))
Original file line number Diff line number Diff line change @@ -3,8 +3,8 @@ use std::thread;
3
3
#[ no_mangle]
4
4
pub extern fn triple ( x : i32 ) -> i32 {
5
5
6
- let _ : Vec < _ > = ( 0 ..10 ) . map ( |i| {
7
- thread:: scoped ( move || {
6
+ let handles : Vec < _ > = ( 0 ..10 ) . map ( |i| {
7
+ thread:: spawn ( move || {
8
8
println ! ( "Thread {} running" , i) ;
9
9
10
10
let mut x = 0 ;
@@ -16,6 +16,10 @@ pub extern fn triple(x: i32) -> i32 {
16
16
} )
17
17
} ) . collect ( ) ;
18
18
19
+ for h in handles {
20
+ h. join ( ) . unwrap ( ) ;
21
+ }
22
+
19
23
x * 3
20
24
}
21
25
Original file line number Diff line number Diff line change 7
7
ffi .cdef ("""
8
8
int calculate(const char *script);
9
9
""" )
10
- C = ffi .dlopen ("target/release/libcalc-771b1f816b5bd78c .dylib" )
10
+ C = ffi .dlopen ("target/release/libcalc.dylib" )
11
11
12
12
def main ():
13
13
result = C .calculate (b"+ * * + * - /" )
Original file line number Diff line number Diff line change 7
7
int double(int);
8
8
""" )
9
9
10
- C = ffi .dlopen ("target/release/libdouble-8612fd65af997c10 .dylib" )
10
+ C = ffi .dlopen ("target/release/libdouble.dylib" )
11
11
12
- print (C .double (3 ))
12
+ print (C .double (9 ))
You can’t perform that action at this time.
0 commit comments