/** * It run and wait all threads to finish. */ int run_and_wait_end() { if (isfrozen()) return -1; // FIX !!!! stop(); if (run()<0) return -1; if (wait()<0) return -1; return 0; }
/** * It run and then freeze. */ int run_then_freeze() { if (isfrozen()) { // true means that next time threads are frozen again thaw(true); return 0; } if (!prepared) if (prepare()<0) return -1; freeze(); return run(); }
/// Run and then freeze. int run_then_freeze() { if (isfrozen()) { thaw(); freeze(); return 0; } if (!prepared) if (prepare()<0) return -1; freeze(); return run(); }
/** * \brief Waits for thread termination * * It defines the wait for thread termination. * * \return 0 if successful. */ int wait() { stp=true; if (isfrozen()) { wait_freezing(); thaw(); } if (spawned) { pthread_join(th_handle, NULL); if (barrier) barrier->decCounter(); } if (pthread_attr_destroy(&attr)) { error("ERROR: ff_thread.wait: pthread_attr_destroy fails!"); } spawned=false; return 0; }
virtual int wait() { int r=0; stp=true; if (isfrozen()) { wait_freezing(); thaw(); } if (spawned) { pthread_join(th_handle, NULL); if (barrier) barrier->decCounter(); } if (attr) { if (pthread_attr_destroy(attr)) { error("ERROR: ff_thread.wait: pthread_attr_destroy fails!"); r=-1; } free(attr); attr = NULL; } spawned=false; return r; }