1
0
forked from fsfw/fsfw

all cstdout uses wrapped in preprocessor defines

This commit is contained in:
2021-01-03 13:58:18 +01:00
parent 61fc6cac97
commit c19e628d79
96 changed files with 715 additions and 14 deletions

View File

@ -12,24 +12,32 @@ Mutex::Mutex() {
pthread_mutexattr_t mutexAttr;
int status = pthread_mutexattr_init(&mutexAttr);
if (status != 0) {
#if CPP_OSTREAM_ENABLED == 1
sif::error << "Mutex: Attribute init failed with: " << strerror(status) << std::endl;
#endif
}
status = pthread_mutexattr_setprotocol(&mutexAttr, PTHREAD_PRIO_INHERIT);
if (status != 0) {
#if CPP_OSTREAM_ENABLED == 1
sif::error << "Mutex: Attribute set PRIO_INHERIT failed with: " << strerror(status)
<< std::endl;
#endif
}
status = pthread_mutex_init(&mutex, &mutexAttr);
if (status != 0) {
#if CPP_OSTREAM_ENABLED == 1
sif::error << "Mutex: creation with name, id " << mutex.__data.__count
<< ", " << " failed with " << strerror(status) << std::endl;
#endif
}
// After a mutex attributes object has been used to initialize one or more
// mutexes, any function affecting the attributes object
// (including destruction) shall not affect any previously initialized mutexes.
status = pthread_mutexattr_destroy(&mutexAttr);
if (status != 0) {
#if CPP_OSTREAM_ENABLED == 1
sif::error << "Mutex: Attribute destroy failed with " << strerror(status) << std::endl;
#endif
}
}