mutex_lock_killable(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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:


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