File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ impl ThreadedVirtualMachine {
9393 /// to the parent thread and then `join()` on the `JoinHandle` (or similar), there is a possibility that
9494 /// the current thread will panic as `PyObjectRef`'s `Drop` implementation tries to run the `__del__`
9595 /// destructor of a python object but finds that it's not in the context of any vm.
96- pub fn run < F , R > ( self , f : F ) -> R
96+ pub fn run < F , R > ( & self , f : F ) -> R
9797 where
9898 F : FnOnce ( & VirtualMachine ) -> R ,
9999 {
@@ -118,8 +118,8 @@ impl VirtualMachine {
118118 F : Send + ' static ,
119119 R : Send + ' static ,
120120 {
121- let thread = self . new_thread ( ) ;
122- std:: thread:: spawn ( || thread . run ( f ) )
121+ let func = self . new_thread ( ) . make_spawn_func ( f ) ;
122+ std:: thread:: spawn ( func )
123123 }
124124
125125 /// Create a new VM thread that can be passed to a function like [`std::thread::spawn`]
You can’t perform that action at this time.
0 commit comments