mutex_lock_killable(9)
β¨ mutex_lock_killable(9) β¨
okay bestie, welcome to the Kernel API Manual π this one's a little function with main character energy β it grabs a lock, but it's polite enough to bail if something fatal shows up. let's get into it π«Ά
πΈ NAME πΈ
mutex_lock_killable β acquire the mutex, interruptible by fatal signals. literally what it says on the tin, no cap π
π¦ SYNOPSIS π¦
int mutex_lock_killable (struct mutex *lock );
π ARGUMENTS π
lockβ the mutex to be acquired. that's the one, the only, the icon π
π DESCRIPTION π
so here's the vibe: it locks the mutex like mutex_lock does β same energy, same goal. BUT π₯ if a signal that will be fatal to the current process gets delivered while the process is sleeping, this function just... returns. without acquiring the mutex. no lock, no drama, it's giving graceful exit π
like, it's not gonna sit there holding on when the universe is telling your process it's over. iconic behaviour honestly.
π CONTEXT π
Process context. (iykyk β that's where this function lives, don't try it anywhere else π)
β RETURN β
0β slay, the lock was successfully acquired π-EINTRβ a fatal signal arrived π so no lock for you
π SEE ALSO π
Kernel file ./kernel/locking/mutex.c plus the whole friend group:
mutex_lock(9)mutex_unlock(9)ww_mutex_unlock(9)ww_mutex_trylock(9)mutex_lock_interruptible(9)mutex_lock_io(9)mutex_trylock(9)atomic_dec_and_mutex_lock(9)
okay that's the whole page bestie, you ate that π
β¨ this lil gem lives in ./kernel/locking and it's dated October 2026 β go forth and lock responsibly, mwah ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms