Fixed a bug for calling pthread_join
authorBo Li <bli@cs.wisc.edu>
Mon, 23 Jul 2012 00:01:16 +0000 (19:01 -0500)
committerBo Li <bli@cs.wisc.edu>
Mon, 23 Jul 2012 00:01:16 +0000 (19:01 -0500)
EM.cpp
Gibbs.cpp
calcCI.cpp

diff --git a/EM.cpp b/EM.cpp
index 0d38728..684d639 100644 (file)
--- 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);
index 63d35a8..6bbfeb1 100644 (file)
--- 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();
index 99ce148..c71d9c1 100644 (file)
@@ -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!");
        }