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 {
93
93
/// to the parent thread and then `join()` on the `JoinHandle` (or similar), there is a possibility that
94
94
/// the current thread will panic as `PyObjectRef`'s `Drop` implementation tries to run the `__del__`
95
95
/// 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
97
97
where
98
98
F : FnOnce ( & VirtualMachine ) -> R ,
99
99
{
@@ -118,8 +118,8 @@ impl VirtualMachine {
118
118
F : Send + ' static ,
119
119
R : Send + ' static ,
120
120
{
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 )
123
123
}
124
124
125
125
/// 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