summaryrefslogtreecommitdiff
path: root/libcutils/hashmap.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-07-13 10:54:49 -0700
committerElliott Hughes <enh@google.com>2018-07-13 10:54:49 -0700
commit9d12725cad91a4074f01a5eb66fd2f3e6978f590 (patch)
tree73d185d7c812393fff0a6c79d281c13d372f4cce /libcutils/hashmap.cpp
parent097381382bb49547b847c90e0471694d84ce68f6 (diff)
cutils: move hashmap to <pthread.h>.
Bug: N/A Test: builds Change-Id: I16a470265a17ea5bd47ef76ec234907cf7ec3e4f
Diffstat (limited to 'libcutils/hashmap.cpp')
-rw-r--r--libcutils/hashmap.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/libcutils/hashmap.cpp b/libcutils/hashmap.cpp
index 2a4a52e1a..57d60067c 100644
--- a/libcutils/hashmap.cpp
+++ b/libcutils/hashmap.cpp
@@ -18,7 +18,7 @@
#include <assert.h>
#include <errno.h>
-#include <cutils/threads.h>
+#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
@@ -36,7 +36,7 @@ struct Hashmap {
size_t bucketCount;
int (*hash)(void* key);
bool (*equals)(void* keyA, void* keyB);
- mutex_t lock;
+ pthread_mutex_t lock;
size_t size;
};
@@ -69,7 +69,7 @@ Hashmap* hashmapCreate(size_t initialCapacity,
map->hash = hash;
map->equals = equals;
- mutex_init(&map->lock);
+ pthread_mutex_init(&map->lock, nullptr);
return map;
}
@@ -129,11 +129,11 @@ static void expandIfNecessary(Hashmap* map) {
}
void hashmapLock(Hashmap* map) {
- mutex_lock(&map->lock);
+ pthread_mutex_lock(&map->lock);
}
void hashmapUnlock(Hashmap* map) {
- mutex_unlock(&map->lock);
+ pthread_mutex_unlock(&map->lock);
}
void hashmapFree(Hashmap* map) {
@@ -147,7 +147,7 @@ void hashmapFree(Hashmap* map) {
}
}
free(map->buckets);
- mutex_destroy(&map->lock);
+ pthread_mutex_destroy(&map->lock);
free(map);
}