News for hackers. Stuff that matters.
Re:Hell is a multi-threaded C++ program (2006) by jcelerier on Sunday September 03, 2017 @06:47AM (#15160763)
> Gah, no. Userspace spinlocks are the deepest of voodoo and something to be used only by people who know exactly what they are doing and would have no difficulty writing "traditional" threaded code in a C/C++ environment.

If you ever used pthread_mutex with glibc then you use spinlocks without knowing it. The implementation spins for some time before going for a full kernel mutex.

Re:Hell is a multi-threaded C++ program (2006) by whatidonteven on Monday September 04, 2017 @08:23AM (#15167709)
There's a bit of a terminology confusion here. When they say "spinlock", most people mean a pure spinlock that spins forever until it succeeds.

"Mutex" on the other hand might have a fast-path that spins a few times before inserting the thread onto a wait list.

Re:Hell is a multi-threaded C++ program (2006) by mannykannot on Sunday September 03, 2017 @10:54AM (#15161718)
I think the warning is directed against rolling your own spinlocks without careful consideration, including a realistic evaluation of whether you know every issue involved in doing so.
Re:Hell is a multi-threaded C++ program (2006) by ajross on Sunday September 03, 2017 @10:51AM (#15161701)
Sure, and C library authors qualify. App developers don't.