MCPcopy Create free account
hub / github.com/Starry-OS/StarryOS / handle_futex_death

Function handle_futex_death

api/src/task.rs:109–125  ·  view source on GitHub ↗
(entry: *mut RobustList, offset: i64)

Source from the content-addressed store, hash-verified

107}
108
109fn handle_futex_death(entry: *mut RobustList, offset: i64) -> AxResult<()> {
110 let address = (entry as u64)
111 .checked_add_signed(offset)
112 .ok_or(AxError::InvalidInput)?;
113 let address: usize = address.try_into().map_err(|_| AxError::InvalidInput)?;
114 let key = FutexKey::new_current(address);
115
116 let curr = current();
117 let futex_table = curr.as_thread().proc_data.futex_table_for(&key);
118
119 let Some(futex) = futex_table.get(&key) else {
120 return Ok(());
121 };
122 futex.owner_dead.store(true, Ordering::SeqCst);
123 futex.wq.wake(1, u32::MAX);
124 Ok(())
125}
126
127pub fn exit_robust_list(head: *const RobustListHead) -> AxResult<()> {
128 // Reference: https://elixir.bootlin.com/linux/v6.13.6/source/kernel/futex/core.c#L777

Callers 1

exit_robust_listFunction · 0.85

Calls 4

futex_table_forMethod · 0.80
as_threadMethod · 0.80
getMethod · 0.45
wakeMethod · 0.45

Tested by

no test coverage detected