wangzhengquan
2020-07-07 379f42982b8c57ee6511cb8e498019f454323977
squeue/sem_util.c
File was renamed from squeue/pcsem.c
@@ -1,7 +1,7 @@
#include "pcsem.h"
#include "sem_util.h"
int pcsem::init(key_t key, unsigned int value) {
int SemUtil::get(key_t key, unsigned int value) {
    int semid, perms;
     
    perms = S_IRUSR | S_IWUSR;
@@ -70,7 +70,7 @@
   set to EINTR if operation was interrupted by a signal handler */
/* Reserve semaphore - decrement it by 1 */
int pcsem::dec(int semId)
int SemUtil::dec(int semId)
{
    struct sembuf sops;
@@ -85,7 +85,7 @@
    return 0;
}
int pcsem::dec_nowait(int semId)
int SemUtil::dec_nowait(int semId)
{
    struct sembuf sops;
@@ -100,7 +100,7 @@
    return 0;
}
int pcsem::dec_timeout(int semId, struct timespec * timeout)
int SemUtil::dec_timeout(int semId, struct timespec * timeout)
{
    struct sembuf sops;
@@ -118,7 +118,7 @@
/* Release semaphore - increment it by 1 */
int pcsem::inc(int semId)
int SemUtil::inc(int semId)
{
    struct sembuf sops;
@@ -129,7 +129,7 @@
    return semop(semId, &sops, 1);
}
void pcsem::remove(int semid) {
void SemUtil::remove(int semid) {
    union semun dummy;
    if (semctl(semid, 0, IPC_RMID, dummy) == -1)
        err_exit(errno, "semctl");