From 7f503f1b9e22d7e1b44472add2263f263675b7c7 Mon Sep 17 00:00:00 2001 From: Bo Li Date: Sun, 22 Jul 2012 19:01:16 -0500 Subject: [PATCH] Fixed a bug for calling pthread_join --- EM.cpp | 7 +++---- Gibbs.cpp | 3 +-- calcCI.cpp | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/EM.cpp b/EM.cpp index 0d38728..684d639 100644 --- a/EM.cpp +++ b/EM.cpp @@ -423,7 +423,6 @@ void EM() { Params fparams[nThreads]; pthread_t threads[nThreads]; pthread_attr_t attr; - void *status; int rc; @@ -471,7 +470,7 @@ void EM() { } for (int i = 0; i < nThreads; i++) { - rc = pthread_join(threads[i], &status); + rc = pthread_join(threads[i], NULL); pthread_assert(rc, "pthread_join", "Cannot join thread " + itos(i) + " (numbered from 0) at ROUND " + itos(ROUND) + "!"); } @@ -521,7 +520,7 @@ void EM() { pthread_assert(rc, "pthread_create", "Cannot create thread " + itos(i) + " (numbered from 0) when generating files for Gibbs sampler!"); } for (int i = 0; i < nThreads; i++) { - rc = pthread_join(threads[i], &status); + rc = pthread_join(threads[i], NULL); pthread_assert(rc, "pthread_join", "Cannot join thread " + itos(i) + " (numbered from 0) when generating files for Gibbs sampler!"); } } @@ -581,7 +580,7 @@ void EM() { pthread_assert(rc, "pthread_create", "Cannot create thread " + itos(i) + " (numbered from 0) when calculating expected weights!"); } for (int i = 0; i < nThreads; i++) { - rc = pthread_join(threads[i], &status); + rc = pthread_join(threads[i], NULL); pthread_assert(rc, "pthread_join", "Cannot join thread " + itos(i) + " (numbered from 0) when calculating expected weights!"); } model.setNeedCalcConPrb(false); diff --git a/Gibbs.cpp b/Gibbs.cpp index 63d35a8..6bbfeb1 100644 --- a/Gibbs.cpp +++ b/Gibbs.cpp @@ -70,7 +70,6 @@ bool quiet; Params *paramsArray; pthread_t *threads; pthread_attr_t attr; -void *status; int rc; void load_data(char* reference_name, char* statName, char* imdName) { @@ -443,7 +442,7 @@ int main(int argc, char* argv[]) { pthread_assert(rc, "pthread_create", "Cannot create thread " + itos(i) + " (numbered from 0)!"); } for (int i = 0; i < nThreads; i++) { - rc = pthread_join(threads[i], &status); + rc = pthread_join(threads[i], NULL); pthread_assert(rc, "pthread_join", "Cannot join thread " + itos(i) + " (numbered from 0)!"); } release(); diff --git a/calcCI.cpp b/calcCI.cpp index 99ce148..c71d9c1 100644 --- a/calcCI.cpp +++ b/calcCI.cpp @@ -69,7 +69,6 @@ bool quiet; Params *paramsArray; pthread_t *threads; pthread_attr_t attr; -void *status; int rc; CIParams *ciParamsArray; @@ -219,7 +218,7 @@ void sample_theta_vectors_from_count_vectors() { pthread_assert(rc, "pthread_create", "Cannot create thread " + itos(i) + " (numbered from 0) in sample_theta_vectors_from_count_vectors!"); } for (int i = 0; i < num_threads; i++) { - rc = pthread_join(threads[i], &status); + rc = pthread_join(threads[i], NULL); pthread_assert(rc, "pthread_join", "Cannot join thread " + itos(i) + " (numbered from 0) in sample_theta_vectors_from_count_vectors!"); } @@ -359,7 +358,7 @@ void calculate_credibility_intervals(char* imdName) { pthread_assert(rc, "pthread_create", "Cannot create thread " + itos(i) + " (numbered from 0) in calculate_credibility_intervals!"); } for (int i = 0; i < num_threads; i++) { - rc = pthread_join(threads[i], &status); + rc = pthread_join(threads[i], NULL); pthread_assert(rc, "pthread_join", "Cannot join thread " + itos(i) + " (numbered from 0) in calculate_credibility_intervals!"); } -- 2.39.2