浏览代码

properly compare pthread_ts

Samuel Thibault 15 年之前
父节点
当前提交
d66f2be6a9
共有 2 个文件被更改,包括 6 次插入2 次删除
  1. 4 0
      include/pthread-win32/pthread.h
  2. 2 2
      src/core/workers.c

+ 4 - 0
include/pthread-win32/pthread.h

@@ -63,6 +63,10 @@ static inline pthread_t pthread_self(void) {
   return GetCurrentThread();
 }
 
+static inline int pthread_equal(pthread_t t1, pthread_t t2) {
+  return t1 == t2;
+}
+
 static inline int pthread_attr_init (pthread_attr_t *attr) {
   *attr = 0;
   return 0;

+ 2 - 2
src/core/workers.c

@@ -275,7 +275,7 @@ static void _starpu_terminate_workers(struct machine_config_s *config)
  		 * we have to check if pthread_self() is the worker itself */
 		if (set){ 
 			if (!set->joined) {
-				if (pthread_self() != set->worker_thread)
+				if (!pthread_equal(pthread_self(), set->worker_thread))
 				{
 					status = pthread_join(set->worker_thread, NULL);
 #ifdef VERBOSE
@@ -288,7 +288,7 @@ static void _starpu_terminate_workers(struct machine_config_s *config)
 			}
 		}
 		else {
-			if (pthread_self() != worker->worker_thread)
+			if (!pthread_equal(pthread_self(), worker->worker_thread))
 			{
 				status = pthread_join(worker->worker_thread, NULL);
 #ifdef VERBOSE