git://git.onelab.eu
/
sliver-openvswitch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
clang: Add annotations for thread safety check.
[sliver-openvswitch.git]
/
lib
/
uuid.c
diff --git
a/lib/uuid.c
b/lib/uuid.c
index
7b03fe0
..
18748ea
100644
(file)
--- a/
lib/uuid.c
+++ b/
lib/uuid.c
@@
-81,19
+81,19
@@
uuid_init(void)
void
uuid_generate(struct uuid *uuid)
{
void
uuid_generate(struct uuid *uuid)
{
- static
pthread_mutex_t mutex = PTHREAD
_ADAPTIVE_MUTEX_INITIALIZER;
+ static
struct ovs_mutex mutex = OVS
_ADAPTIVE_MUTEX_INITIALIZER;
uint64_t copy[2];
uuid_init();
/* Copy out the counter's current value, then increment it. */
uint64_t copy[2];
uuid_init();
/* Copy out the counter's current value, then increment it. */
-
xpthread
_mutex_lock(&mutex);
+
ovs
_mutex_lock(&mutex);
copy[0] = counter[0];
copy[1] = counter[1];
if (++counter[1] == 0) {
counter[0]++;
}
copy[0] = counter[0];
copy[1] = counter[1];
if (++counter[1] == 0) {
counter[0]++;
}
-
xpthread
_mutex_unlock(&mutex);
+
ovs
_mutex_unlock(&mutex);
/* AES output is exactly 16 bytes, so we encrypt directly into 'uuid'. */
aes128_encrypt(&key, copy, uuid);
/* AES output is exactly 16 bytes, so we encrypt directly into 'uuid'. */
aes128_encrypt(&key, copy, uuid);