previous: >>108252317
#define __NR_semget 64
#define __NR_semop 65
#define __NR_semctl 66
https://man7.org/linux/man-pages/man2/semget.2.html
https://man7.org/linux/man-pages/man2/semop.2.html
https://man7.org/linux/man-pages/man2/semctl.2.html
tl;dr:
semaphores, but worse!
https://man7.org/linux/man-pages/man7/sem_overview.7.html
to be clear, these syscalls are NOT posix semaphores. but the above link mentions them in the notes, and it should explain a bit more
i try to avoid any multi-threading primitives outside of the basic mutex and condition variable. i know that the others have their places, and there are definitely circumstances where they're far better suited to the task at hand, but they're also way less widely known and used. if you stick to just mutexes and cvs, it's a lot easier for anyone coming after you to read your code and know what the hell is going on.
what about you, anon? what's been your experience with multi-threading primitives? have you ever used semaphores before? if so, why?
bonus: https://en.wikipedia.org/wiki/Semaphore
are you familiar with where the term semaphore came from? most people are, but in case you aren't, give this article a read. it's pretty interesting
relevant resources:
man man
man syscalls
https://man7.org/linux/man-pages/
https://linux.die.net/man/
https://elixir.bootlin.com/linux/
https://elixir.bootlin.com/musl/
https://elixir.bootlin.com/glibc/