Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Sun, 21 Jun 2015 17:10:42 +1000
From: Comm Unist <>
Subject: Problem with c++ and std::thread comparison

What happens when you try to call a weak symbol? Do you end up calling 0x000000.....00 depending on your arch?

I ask because I have C++ program that uses std::threads. These use pthreads internally. There were two places where I have problems. One was with condtiion variables and the other with comparsion of std::thread ids:

This changes seems to work, or does c++ not needs to check pthreads being equal?

diff --git a/include/pthread.h b/include/pthread.h
index 99a74a5..e97b9e4 100644
--- a/include/pthread.h
+++ b/include/pthread.h
@@ -85,9 +85,7 @@ __attribute__((const))
 pthread_t pthread_self(void);
 int pthread_equal(pthread_t, pthread_t);
-#ifndef __cplusplus
-#define pthread_equal(x,y) ((x)==(y))
+inline int pthread_equal(pthread_t a, pthread_t b) { return a == b; }
 int pthread_setcancelstate(int, int *);
 int pthread_setcanceltype(int, int *);

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.