MCPcopy Index your code
hub / github.com/RustPython/RustPython / set_done_internal

Method set_done_internal

crates/vm/src/stdlib/_thread.rs:1322–1343  ·  view source on GitHub ↗
(
            inner: &Arc<parking_lot::Mutex<ThreadHandleInner>>,
            done_event: &Arc<(parking_lot::Mutex<bool>, parking_lot::Condvar)>,
            vm: &VirtualMachine,
        )

Source from the content-addressed store, hash-verified

1320 }
1321
1322 fn set_done_internal(
1323 inner: &Arc<parking_lot::Mutex<ThreadHandleInner>>,
1324 done_event: &Arc<(parking_lot::Mutex<bool>, parking_lot::Condvar)>,
1325 vm: &VirtualMachine,
1326 ) -> PyResult<()> {
1327 Self::check_started(inner, vm)?;
1328 {
1329 let mut inner_guard = inner.lock();
1330 inner_guard.state = ThreadHandleState::Done;
1331 // _set_done() detach path. Dropping the JoinHandle
1332 // detaches the underlying Rust thread.
1333 inner_guard.join_handle = None;
1334 inner_guard.joining = false;
1335 inner_guard.joined = true;
1336 }
1337 remove_from_shutdown_handles(vm, inner, done_event);
1338
1339 let (lock, cvar) = &**done_event;
1340 *lock.lock() = true;
1341 cvar.notify_all();
1342 Ok(())
1343 }
1344
1345 fn parse_join_timeout(
1346 timeout_obj: Option<crate::PyObjectRef>,

Callers

nothing calls this directly

Calls 3

lockMethod · 0.45
notify_allMethod · 0.45

Tested by

no test coverage detected