wangzhengquan
2020-07-23 6da3e92dab82554db8492d2bd7981ecd9ef3fd65
src/queue/hashtable.c
@@ -91,9 +91,12 @@
  size_t code = hashcode(key);
  tailq_entry_t *item;
  void *oldvalue;
  SemUtil::dec(hashtable->wlock);
  tailq_header_t *my_tailq_head = hashtable->array[code] ;
  if ( my_tailq_head == NULL)
  {
    SemUtil::inc(hashtable->wlock);
    return NULL;
  }
  else
@@ -108,11 +111,12 @@
        /* mm_free the item as we don't need it anymore. */
        mm_free(item);
        SemUtil::inc(hashtable->wlock);
        return oldvalue;
      }
    }
  }
  SemUtil::inc(hashtable->wlock);
  return NULL;
}
@@ -124,6 +128,7 @@
void hashtable_removeall(hashtable_t *hashtable)
{
  tailq_entry_t *item;
  SemUtil::dec(hashtable->wlock);
  for (int i = 0; i < MAPSIZE; i++)
  {
    tailq_header_t *my_tailq_head = hashtable->array[i] ;
@@ -139,6 +144,7 @@
    mm_free(my_tailq_head);
    hashtable->array[i] = NULL;
  }
  SemUtil::inc(hashtable->wlock);
}
/**