wangzhengquan
2020-09-25 00dba6082e245d917cb7d6eed3c627211ff41cd7
src/util/sem_util.c
@@ -4,6 +4,7 @@
static Logger logger = LoggerFactory::getLogger();
int SemUtil::get(key_t key, unsigned int value) {
// printf("==================SemUtil::get===============================\n");
  int semid, perms;
  perms = S_IRUSR | S_IWUSR;
@@ -72,6 +73,7 @@
/* Reserve semaphore - decrement it by 1 */
int SemUtil::dec(int semId) {
// logger.debug("%d: SemUtil::dec\n", semId);
  struct sembuf sops;
  sops.sem_num = 0;
@@ -103,7 +105,7 @@
  return 0;
}
int SemUtil::dec_timeout(int semId, struct timespec *timeout) {
int SemUtil::dec_timeout(const int semId, const struct timespec *timeout) {
  struct sembuf sops;
  sops.sem_num = 0;
@@ -112,7 +114,7 @@
  while (semtimedop(semId, &sops, 1, timeout) == -1)
    if (errno != EINTR) {
      err_msg(errno, "SemUtil::dec_timeout");
     // err_msg(errno, "SemUtil::dec_timeout");
      return -1;
    }