finish_wait(9)
β¨ finish_wait(9) β¨
okay so this is a page from the Kernel API Manual, and bestie, it's a short one but it's lowkey important β it's the "okay we're done here, pack it up" function for waitqueues π
πΈ NAME πΈ
finish_wait β clean up after waiting in a queue
like, you waited, you got woken up, now tidy your mess π§Ήβ¨
π SYNOPSIS π
void finish_wait (struct wait_queue_head *wq_head , struct
wait_queue_entry *wq_entry );
it returns void, so no surprises, no return value to check, she just does her thing and leaves π«Ά
π¦ ARGUMENTS π¦
wq_headβ the waitqueue you were waited on. the queue itself, the main character πwq_entryβ your wait descriptor, aka your little ticket that says "hi yes I was in this queue" ποΈ
π DESCRIPTION π
so here's the tea β: finish_wait does two things and it does them with zero drama.
- It sets the current thread back to running state β you're up, you're awake, you're that girl now β
- It removes the wait descriptor from the given waitqueue if it's still queued β like, if you're still sitting in the queue, it takes you out. if you already got pulled out, no biggie, it handles that too π
that's literally it. no cap. it's the cleanup crew for wait_event-style waiting, and it's not here to be flashy, it's here to make sure nothing's left hanging π₯
π SEE ALSO π
- Kernel file
./kernel/sched/wait.c __wake_up(9)__wake_up_sync_key(9)__wake_up_locked_sync_key(9)
go read those if you wanna see who does the waking while finish_wait does the cleaning π
fr fr bestie: this pairs with the wakeup functions up there. you queue up, someone wakes you, and then finish_wait is your graceful exit. iconic behaviour, no notes π§
and that's the whole page!! source lives over in ./kernel/sched, dated October 2026 β mwah, go write some kernel code, you're gonna slay π
ππ
π¦ 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