MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / drop

Method drop

atomic-repository/src/repository/tests/operation_lock_tests.rs:62–80  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

60
61impl Drop for ChildLockHolder {
62 fn drop(&mut self) {
63 let _ = fs::write(&self.release_path, b"release\n");
64 let deadline = Instant::now() + Duration::from_secs(10);
65 loop {
66 match self.child.try_wait() {
67 Ok(Some(status)) => {
68 assert!(status.success(), "lock-holder child failed: {status}");
69 return;
70 }
71 Ok(None) if Instant::now() < deadline => thread::sleep(Duration::from_millis(10)),
72 Ok(None) => {
73 let _ = self.child.kill();
74 let _ = self.child.wait();
75 panic!("timed out waiting for lock-holder child to exit");
76 }
77 Err(error) => panic!("failed waiting for lock-holder child: {error}"),
78 }
79 }
80 }
81}
82
83#[test]

Callers

nothing calls this directly

Calls 1

writeFunction · 0.50

Tested by

no test coverage detected