aboutsummaryrefslogtreecommitdiff
path: root/lib/uuid.c
diff options
context:
space:
mode:
authorEthan Jackson <ethan@nicira.com>2013-07-30 15:31:48 -0700
committerBen Pfaff <blp@nicira.com>2013-07-30 21:30:45 -0700
commit97be153858b4cd175cbe7862b8e1624bf22ab98a (patch)
treeab1e518bef4e8bbc97fe8a069d9b91541bb9c4d4 /lib/uuid.c
parent2b51596fdeba7fbf4caff323dd6af375e7f84596 (diff)
clang: Add annotations for thread safety check.
This commit adds annotations for thread safety check. And the check can be conducted by using -Wthread-safety flag in clang. Co-authored-by: Alex Wang <alexw@nicira.com> Signed-off-by: Alex Wang <alexw@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/uuid.c')
-rw-r--r--lib/uuid.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/uuid.c b/lib/uuid.c
index 7b03fe0b..18748ea9 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -81,19 +81,19 @@ uuid_init(void)
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. */
- xpthread_mutex_lock(&mutex);
+ ovs_mutex_lock(&mutex);
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);