Re:System V Semaphores: How not to design an API
by jaywalker on Saturday December 25, 2010 @05:39AM
(#2038779)
Yes, that's exactly why I think the "operations" concept was added. But isn't it good to provide extra sem_wait() and sem_post() for most of the rest of us who want a single increment or a decrement? I have yet to find a good use of an array of operations in a single atomic fashion. Neither dining philosophers nor reader-writers need multiple increments/ decrements in one go.
With the semop() function, you put all your desired operations in one array of ops, and make one semop call, which does all the operations atomically.