/** * \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; }