| | |
| | | sops.sem_flg = 0; |
| | | |
| | | while (semop(semId, &sops, 1) == -1) |
| | | if (errno != EINTR ) |
| | | if (errno != EINTR ) { |
| | | err_msg(errno, "SemUtil::dec"); |
| | | return -1; |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | |
| | | sops.sem_flg = IPC_NOWAIT; |
| | | |
| | | while (semop(semId, &sops, 1) == -1) |
| | | if (errno != EINTR ) |
| | | if (errno != EINTR ) { |
| | | err_msg(errno, "SemUtil::dec_nowait"); |
| | | return -1; |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | |
| | | sops.sem_flg = 0; |
| | | |
| | | while ( semtimedop(semId, &sops, 1, timeout) == -1) |
| | | if (errno != EINTR ) |
| | | if (errno != EINTR ) { |
| | | err_msg(errno, "SemUtil::dec_timeout"); |
| | | return -1; |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | |
| | | sops.sem_op = 1; |
| | | sops.sem_flg = 0; |
| | | |
| | | return semop(semId, &sops, 1); |
| | | int rv = semop(semId, &sops, 1); |
| | | if(rv == -1) { |
| | | err_msg(errno, "SemUtil::inc"); |
| | | } |
| | | return rv; |
| | | } |
| | | |
| | | void SemUtil::remove(int semid) { |