瀏覽代碼

macro for pthread_equal

no sense bloating apps with a function call for an equality comparison...
Rich Felker 13 年之前
父節點
當前提交
9205e48609
共有 2 個文件被更改,包括 3 次插入1 次删除
  1. 2 0
      include/pthread.h
  2. 1 1
      src/thread/pthread_equal.c

+ 2 - 0
include/pthread.h

@@ -80,7 +80,9 @@ int pthread_join(pthread_t, void **);
 __attribute__((const))
 #endif
 pthread_t pthread_self(void);
+
 int pthread_equal(pthread_t, pthread_t);
+#define pthread_equal(x,y) ((x)==(y))
 
 int pthread_setcancelstate(int, int *);
 int pthread_setcanceltype(int, int *);

+ 1 - 1
src/thread/pthread_equal.c

@@ -1,6 +1,6 @@
 #include <pthread.h>
 
-int pthread_equal(pthread_t a, pthread_t b)
+int (pthread_equal)(pthread_t a, pthread_t b)
 {
 	return a==b;
 }