Use pthread_equals in libpbd for portability

This commit is contained in:
Paul Davis 2013-07-11 11:40:59 -04:00
parent f47499f157
commit 117118e5f0

View file

@ -127,7 +127,7 @@ pthread_kill_all (int signum)
{ {
pthread_mutex_lock (&thread_map_lock); pthread_mutex_lock (&thread_map_lock);
for (ThreadMap::iterator i = all_threads.begin(); i != all_threads.end(); ++i) { for (ThreadMap::iterator i = all_threads.begin(); i != all_threads.end(); ++i) {
if ((*i) != pthread_self()) { if (!pthread_equal ((*i), pthread_self())) {
pthread_kill ((*i), signum); pthread_kill ((*i), signum);
} }
} }
@ -140,7 +140,7 @@ pthread_cancel_all ()
{ {
pthread_mutex_lock (&thread_map_lock); pthread_mutex_lock (&thread_map_lock);
for (ThreadMap::iterator i = all_threads.begin(); i != all_threads.end(); ++i) { for (ThreadMap::iterator i = all_threads.begin(); i != all_threads.end(); ++i) {
if ((*i) != pthread_self()) { if (!pthread_equal ((*i), pthread_self())) {
pthread_cancel ((*i)); pthread_cancel ((*i));
} }
} }
@ -153,7 +153,7 @@ pthread_cancel_one (pthread_t thread)
{ {
pthread_mutex_lock (&thread_map_lock); pthread_mutex_lock (&thread_map_lock);
for (ThreadMap::iterator i = all_threads.begin(); i != all_threads.end(); ++i) { for (ThreadMap::iterator i = all_threads.begin(); i != all_threads.end(); ++i) {
if ((*i) == thread) { if (pthread_equal ((*i), thread)) {
all_threads.erase (i); all_threads.erase (i);
break; break;
} }
@ -170,7 +170,7 @@ pthread_exit_pbd (void* status)
pthread_mutex_lock (&thread_map_lock); pthread_mutex_lock (&thread_map_lock);
for (ThreadMap::iterator i = all_threads.begin(); i != all_threads.end(); ++i) { for (ThreadMap::iterator i = all_threads.begin(); i != all_threads.end(); ++i) {
if ((*i) == thread) { if (pthread_equal ((*i), thread)) {
all_threads.erase (i); all_threads.erase (i);
break; break;
} }