From 940bb9e9238488025bf41eb2b2d3df077274004f Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期三, 13 一月 2021 13:00:50 +0800
Subject: [PATCH] update

---
 src/shm/hashtable.cpp |   27 +++++----------------------
 1 files changed, 5 insertions(+), 22 deletions(-)

diff --git a/src/shm/hashtable.cpp b/src/shm/hashtable.cpp
index 99184b1..8455040 100755
--- a/src/shm/hashtable.cpp
+++ b/src/shm/hashtable.cpp
@@ -189,11 +189,7 @@
 
 void *hashtable_get(hashtable_t *hashtable, int key) {
   
-   if (SemUtil::dec_timeout(hashtable->mutex, &TIMEOUT) != 0) {
-    SemUtil::inc(hashtable->mutex);
-    SemUtil::dec(hashtable->mutex);
-   }
-
+   SemUtil::dec(hashtable->mutex);
    hashtable->readcnt++;
    if (hashtable->readcnt == 1) {
     //鑾峰彇璇诲啓閿�
@@ -221,30 +217,21 @@
 }
 
 void hashtable_put(hashtable_t *hashtable, int key, void *value) {
-  struct timespec timeout = {2, 0};
-  if (SemUtil::dec_timeout(hashtable->mutex, &timeout) != 0) {
-    SemUtil::inc(hashtable->mutex);
-    SemUtil::dec(hashtable->mutex);
-  }
+   
+  SemUtil::dec(hashtable->mutex);
   // 璁剧疆璇讳紭鍏堢骇楂�
   while (hashtable->readcnt > 0)
   {
     SemUtil::set(hashtable->cond, 0);
     SemUtil::inc(hashtable->mutex);
     //绛夊緟鍐欓�氱煡
-    if (SemUtil::dec_timeout(hashtable->cond, &timeout) != 0) {
-      hashtable->readcnt = 0;
-      SemUtil::inc(hashtable->cond);
-      SemUtil::dec(hashtable->cond);
-    }
+    SemUtil::dec(hashtable->cond);
 
     SemUtil::dec(hashtable->mutex);
-     
   }
   SemUtil::inc(hashtable->mutex);
 
   //鑾峰彇璇诲啓閿�
- 
   SemUtil::dec(hashtable->wlock);
  // err_msg(0, "hashtable_put dec %d\n", --hashtable->tmp);
 
@@ -321,11 +308,7 @@
 
 int hashtable_alloc_key(hashtable_t *hashtable) {
   int key = START_KEY;
-
-  if (SemUtil::dec_timeout(hashtable->wlock, &TIMEOUT) != 0) {
-    SemUtil::inc(hashtable->wlock);
-    SemUtil::dec(hashtable->wlock);
-  }
+  SemUtil::dec(hashtable->wlock);
 
   while(_hashtable_get(hashtable, key) != NULL) {
     key++;

--
Gitblit v1.8.0