mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
more checks against errors
Signed-off-by: Steffen Vogel <post@steffenvogel.de> Signed-off-by: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de> Co-authored-by: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
This commit is contained in:
parent
5daa3e4dca
commit
e8b2e9c7d5
3 changed files with 37 additions and 12 deletions
|
@ -676,7 +676,9 @@ int villas::node::ib_stop(NodeCompat *n) {
|
|||
|
||||
n->logger->debug("Called rdma_disconnect");
|
||||
} else {
|
||||
pthread_cancel(ib->conn.rdma_cm_event_thread);
|
||||
ret = pthread_cancel(ib->conn.rdma_cm_event_thread);
|
||||
if (ret)
|
||||
throw RuntimeError("Failed to cancel thread");
|
||||
|
||||
n->logger->debug(
|
||||
"Called pthread_cancel() on communication management thread.");
|
||||
|
|
|
@ -470,8 +470,11 @@ int villas::node::rtp_type_start(villas::node::SuperNode *sn) {
|
|||
int villas::node::rtp_type_stop() {
|
||||
int ret;
|
||||
|
||||
// Join worker thread
|
||||
pthread_kill(re_pthread, SIGUSR1);
|
||||
/* Join worker thread */
|
||||
ret = pthread_kill(re_pthread, SIGUSR1);
|
||||
if (ret)
|
||||
throw RuntimeError("Failed to kill thread");
|
||||
|
||||
ret = pthread_join(re_pthread, nullptr);
|
||||
if (ret)
|
||||
throw RuntimeError("Error joining rtp node type pthread");
|
||||
|
|
|
@ -53,21 +53,41 @@ int villas::node::queue_signalled_init(struct CQueueSignalled *qs, size_t size,
|
|||
pthread_condattr_t cvattr;
|
||||
pthread_mutexattr_t mtattr;
|
||||
|
||||
pthread_mutexattr_init(&mtattr);
|
||||
pthread_condattr_init(&cvattr);
|
||||
ret = pthread_mutexattr_init(&mtattr);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = pthread_condattr_init(&cvattr);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (flags & (int)QueueSignalledFlags::PROCESS_SHARED) {
|
||||
pthread_mutexattr_setpshared(&mtattr, PTHREAD_PROCESS_SHARED);
|
||||
pthread_condattr_setpshared(&cvattr, PTHREAD_PROCESS_SHARED);
|
||||
ret = pthread_mutexattr_setpshared(&mtattr, PTHREAD_PROCESS_SHARED);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = pthread_condattr_setpshared(&cvattr, PTHREAD_PROCESS_SHARED);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
pthread_mutex_init(&qs->pthread.mutex, &mtattr);
|
||||
pthread_cond_init(&qs->pthread.ready, &cvattr);
|
||||
ret = pthread_mutex_init(&qs->pthread.mutex, &mtattr);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
pthread_mutexattr_destroy(&mtattr);
|
||||
pthread_condattr_destroy(&cvattr);
|
||||
ret = pthread_cond_init(&qs->pthread.ready, &cvattr);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = pthread_mutexattr_destroy(&mtattr);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = pthread_condattr_destroy(&cvattr);
|
||||
if (ret)
|
||||
return ret;
|
||||
} else if (qs->mode == QueueSignalledMode::POLLING) {
|
||||
// Nothing todo
|
||||
/* Nothing todo */
|
||||
}
|
||||
#ifdef HAS_EVENTFD
|
||||
else if (qs->mode == QueueSignalledMode::EVENTFD) {
|
||||
|
|
Loading…
Add table
Reference in a new issue