Semop: When reducing the set of semaphores, are all reduced immediately or blocked at the first failure?

So, if I have a semaphore set semidwith semaphores num_of_semsand sembuf*deleter_searchers_down

struct sembuf *deleter_searchers_down 
                        = malloc(sizeof (*deleter_searchers_down) * num_of_sems);
for (i = 0; i < num_of_sems; ++i) {
            (deleter_searchers_down + i)->sem_op = -1;
            (deleter_searchers_down + i)->sem_num = i;
            (deleter_searchers_down + i)->sem_flg = SEM_UNDO;
        }
semop(semid, deleter_searchers_down, num_of_sems);

Does semop call try to omit all semaphores in the set at once, or block it when it tries to omit the first semaphore equal to 0, and continue after any other process completes this particular semaphore?

+5
source share
1 answer

No updates occur until all updates are completed as a whole.

The POSIX specification may be clearer in this matter, although it says it semopis atomic.

Linux semop(3) glibc - semop(2). semop(2)

, sops, , , .

HP-UX semop(2) :

       ,        ,        .

+6

All Articles