From: Nadav Har'El <[email protected]>
Committer: Nadav Har'El <[email protected]>
Branch: master
pthread: fix compilation on ARM
For some reason, we had pthread_key_t as unsigned int on arm, but int on
x86,
causing a compilation warning (int/unsigned comparison) on arm.
The type should be unsigned int - like it is on Linux.
Signed-off-by: Nadav Har'El <[email protected]>
---
diff --git a/include/api/x64/bits/alltypes.h.sh
b/include/api/x64/bits/alltypes.h.sh
--- a/include/api/x64/bits/alltypes.h.sh
+++ b/include/api/x64/bits/alltypes.h.sh
@@ -84,7 +84,7 @@ TYPEDEF int key_t;
TYPEDEF unsigned long pthread_t;
TYPEDEF int pthread_once_t;
-TYPEDEF int pthread_key_t;
+TYPEDEF unsigned int pthread_key_t;
TYPEDEF int pthread_spinlock_t;
TYPEDEF struct { union { int __i[14]; size_t __s[7]; } __u; }
pthread_attr_t;
diff --git a/libc/pthread.cc b/libc/pthread.cc
--- a/libc/pthread.cc
+++ b/libc/pthread.cc
@@ -276,7 +276,7 @@ extern "C" {
int pthread_key_delete(pthread_key_t key)
{
std::lock_guard<mutex> guard(tsd_key_mutex);
- if (key < 0 || key >= (int)tsd_used_keys.size() |
| !tsd_used_keys[key]) {
+ if (key < 0 || key >= tsd_used_keys.size() || !tsd_used_keys[key]) {
return EINVAL;
}
tsd_dtor[key] = nullptr;
--
You received this message because you are subscribed to the Google Groups "OSv
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.