aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-03-19 01:58:38 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-03-19 02:04:28 +0100
commitdf24b3a070cc50e521b21fc2877e5b3985535a73 (patch)
tree83712baed4b8b015705becc52c7b03a98c809ca0
parent8bb96d322bd08fc0890602494b8a1c417200b20b (diff)
Fix pthread_join check for valid thread handles
On Linux, checking for > 0 worked because pthread_t is internally an integer type. On other platforms (*caugh* Mac OS X *caugh*), it is typedefed to an opaque pointer, causing a warning if used in an integer relational comparison. The intended use is to allow the generic cleanup function to be used in the error path of the block processor creation function, while preventing pthread_join being called on threads that haven't been created at all. Since they are calloc'ed to 0, testing for non-zero values should suffice in both cases. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--lib/sqfs/block_processor/winpthread.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sqfs/block_processor/winpthread.c b/lib/sqfs/block_processor/winpthread.c
index 1aa77e7..80cbde9 100644
--- a/lib/sqfs/block_processor/winpthread.c
+++ b/lib/sqfs/block_processor/winpthread.c
@@ -34,7 +34,7 @@
# define UNLOCK(mtx) pthread_mutex_unlock(mtx)
# define AWAIT(cond, mtx) pthread_cond_wait(cond, mtx)
# define SIGNAL_ALL(cond) pthread_cond_broadcast(cond)
-# define THREAD_JOIN(t) if (t > 0) { pthread_join(t, NULL); }
+# define THREAD_JOIN(t) if (t != (pthread_t)0) { pthread_join(t, NULL); }
# define MUTEX_DESTROY(mtx) pthread_mutex_destroy(mtx)
# define CONDITION_DESTROY(cond) pthread_cond_destroy(cond)
# define THREAD_EXIT_SUCCESS NULL