From 379f42982b8c57ee6511cb8e498019f454323977 Mon Sep 17 00:00:00 2001 From: wangzhengquan <wangzhengquan85@126.com> Date: 星期二, 07 七月 2020 11:04:39 +0800 Subject: [PATCH] update --- squeue/sem_util.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/squeue/pcsem.c b/squeue/sem_util.c similarity index 92% rename from squeue/pcsem.c rename to squeue/sem_util.c index a95f10d..d7819a2 100644 --- a/squeue/pcsem.c +++ b/squeue/sem_util.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"); -- Gitblit v1.8.0