From 4fd62552d8277f3d0ed20e66663cd219c36796df Mon Sep 17 00:00:00 2001 From: wangzhengquan <wangzhengquan85@126.com> Date: 星期四, 21 一月 2021 11:20:22 +0800 Subject: [PATCH] update --- src/shm/hashtable.cpp | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/shm/hashtable.cpp b/src/shm/hashtable.cpp index e421630..338d482 100755 --- a/src/shm/hashtable.cpp +++ b/src/shm/hashtable.cpp @@ -34,7 +34,13 @@ hashtable->wlock = SemUtil::get(IPC_PRIVATE, 1); hashtable->cond = SemUtil::get(IPC_PRIVATE, 1); hashtable->readcnt = 0; -printf("hashtable->mutex=%d\n", hashtable->mutex); + + FILE * semfile = fopen("./sem.txt", "w+"); + if(semfile == NULL) { + err_exit(errno, "fopen"); + } + fprintf(semfile, "hashtable->mutex=%d\n", hashtable->mutex); + fclose(semfile); } void hashtable_destroy(hashtable_t *hashtable) { @@ -202,9 +208,13 @@ } void *hashtable_get(hashtable_t *hashtable, int key) { - + LoggerFactory::getLogger()->debug( "==========hashtable_get before 1"); + int rv; rv = SemUtil::dec(hashtable->mutex); + + LoggerFactory::getLogger()->debug( "==========hashtable_get before 2"); + if(rv != 0) { LoggerFactory::getLogger()->error(rv, "hashtable_get 1"); } @@ -248,13 +258,14 @@ if(rv != 0) { LoggerFactory::getLogger()->error(rv, "hashtable_get 7"); } + LoggerFactory::getLogger()->debug( "==========hashtable_get after"); return res; } void hashtable_put(hashtable_t *hashtable, int key, void *value) { int rv; - + LoggerFactory::getLogger()->debug( "==========hashtable_put before"); rv = SemUtil::dec(hashtable->mutex); if(rv != 0) { LoggerFactory::getLogger()->error(rv, "hashtable_put\n"); @@ -300,6 +311,8 @@ if(rv != 0) { LoggerFactory::getLogger()->error(rv, "hashtable_put\n"); } + + LoggerFactory::getLogger()->debug( "==========hashtable_put after"); } -- Gitblit v1.8.0