llist_del_first(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ llist_del_first ✨

okay so this is from the Kernel API Manual, section 9 β€” yes the whole (9) thing, that's the section bestie, we love a numbered era πŸŽ€


πŸ’– NAME πŸ’–

llist_del_first β€” delete the first entry of a lock-less list. that's it. that's the whole vibe. πŸ¦‹


🌸 SYNOPSIS 🌸

struct llist_node * llist_del_first (struct llist_head *head );

literally the whole signature, no notes πŸ‘‘


πŸŽ€ ARGUMENTS πŸŽ€

  • head β€” the head for your lock-less list 🫢 like, the actual entry point of the whole thing, you gotta hand it over

πŸ’… DESCRIPTION πŸ’…

okay so first things first: vibe check on the list. if the list is empty, you get NULL back. that's the deal. no list, no entry, no nothing πŸ™ˆ

otherwise? you get the first entry back β€” deleted, babes, it's gone from the list and it's yours now. and here's the fun part: that entry is the newest added one. newest in, first out. it's giving stack energy honestly πŸ’€


now the big caveat, and I need you to actually read this one because it's the whole reason this page exists 😭

Only one llist_del_first user can be used simultaneously with multiple llist_add users β€” and that's without a lock. if you want more consumers than that, nope, not happening, not today bestie.

why? because otherwise, the sequence llist_del_first, llist_add, llist_add in another user may change head->first->next, but keep head->first. yeah. it'll mess with the links and leave the head pointing at the same place, and that is a whole situation πŸ’€ (same energy applies to llist_del_all, llist_add, llist_add in another user β€” that sequence has the same problem, so don't come for me saying I didn't warn you)

so if you genuinely need multiple consumers? you've got two options, pick your fighter:

  • use llist_del_all πŸ‘‘
  • or put a lock between your consumers πŸ”’

no third option, no secret hack, that's the menu πŸ“


🧚 SEE ALSO 🧚


and that's the page!! mwah πŸ’‹ this one came from ./lib and it's dated October 2026 β€” so yeah, mark your calendars, screenshot it, put it in the group chat, the llist lore is timeless fr fr πŸŒˆβ­πŸ’œ

πŸ“¦ where this page comes from