bool TaskHandler::waitHandle(Task& task) { lock_guard<mutex> lockWait(_mutexWait); { lock_guard<recursive_mutex> lock(_mutex); if(_stop) return false; _pTask = &task; } requestHandle(); return _signal.wait(); }
/** * Performs common exit actions for a task of a downstream LDM-7: * -# Logs outstanding error messages if the downstream LDM-7 wasn't shutdown; * -# Frees log-message resources of the current thread; * -# Sets the status of the first task to exit a downstream LDM-7; * -# Sets the task-exited flag of the downstream LDM-7; and * -# Signals the wait condition-variable. * * @param[in] arg Pointer to the downstream LDM-7. * @param[in] status Return status of the exiting task. */ static void taskExit( Down7* const down7, int const status) { /* * Finish with logging. */ done ? log_clear() : log_log(LOG_ERR); // because end of thread log_free(); /* * Inform the managing thread. */ lockWait(down7); if (down7->exitStatus < 0) down7->exitStatus = status; down7->taskExited = 1; pthread_cond_signal(&down7->waitCond); unlockWait(down7); }