MCPcopy Index your code
hub / github.com/arrayfire/arrayfire-rust / thread_move_array

Function thread_move_array

src/core/array.rs:931–950  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

929
930 #[test]
931 fn thread_move_array() {
932 // ANCHOR: move_array_to_thread
933 set_device(0);
934 info();
935 let mut a = constant(1, dim4!(3, 3));
936
937 let handle = thread::spawn(move || {
938 //set_device to appropriate device id is required in each thread
939 set_device(0);
940
941 println!("\nFrom thread {:?}", thread::current().id());
942
943 a += constant(2, dim4!(3, 3));
944 print(&a);
945 });
946
947 //Need to join other threads as main thread holds arrayfire context
948 handle.join().unwrap();
949 // ANCHOR_END: move_array_to_thread
950 }
951
952 #[test]
953 fn thread_borrow_array() {

Callers

nothing calls this directly

Calls 4

set_deviceFunction · 0.85
infoFunction · 0.85
constantFunction · 0.85
printFunction · 0.85

Tested by

no test coverage detected