Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AndroidSystemCore
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Werner Sembach
AndroidSystemCore
Commits
9d12725c
Commit
9d12725c
authored
Jul 13, 2018
by
Elliott Hughes
Browse files
Options
Downloads
Patches
Plain Diff
cutils: move hashmap to <pthread.h>.
Bug: N/A Test: builds Change-Id: I16a470265a17ea5bd47ef76ec234907cf7ec3e4f
parent
09738138
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
libcutils/Android.bp
+1
-1
1 addition, 1 deletion
libcutils/Android.bp
libcutils/hashmap.cpp
+6
-6
6 additions, 6 deletions
libcutils/hashmap.cpp
with
7 additions
and
7 deletions
libcutils/Android.bp
+
1
−
1
View file @
9d12725c
...
...
@@ -20,6 +20,7 @@
libcutils_nonwindows_sources = [
"android_get_control_file.cpp",
"fs.cpp",
"hashmap.cpp",
"multiuser.cpp",
"socket_inaddr_any_server_unix.cpp",
"socket_local_client_unix.cpp",
...
...
@@ -61,7 +62,6 @@ cc_library {
"config_utils.cpp",
"fs_config.cpp",
"canned_fs_config.cpp",
"hashmap.cpp",
"iosched_policy.cpp",
"load_file.cpp",
"native_handle.cpp",
...
...
This diff is collapsed.
Click to expand it.
libcutils/hashmap.cpp
+
6
−
6
View file @
9d12725c
...
...
@@ -18,7 +18,7 @@
#include
<assert.h>
#include
<errno.h>
#include
<
cutils/
thread
s
.h>
#include
<
p
thread.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
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment