Quiet spurious pthread_unlock warnings
A message is output in debug builds when pthread_unlock returns an error. However, in most cases, it should return EPERM. In fact, if it doesn't return EPERM, it is an indication of a problem. This commit adjusts accordingly. Change-Id: Ia5cad89aa6e68e79c1291ea21adffb0fa68f2300
Αυτή η υποβολή περιλαμβάνεται σε:
+10
-2
@@ -460,11 +460,19 @@ rsmi_shut_down(void) {
|
||||
#if DEBUG
|
||||
int ret = 0;
|
||||
#endif
|
||||
for (int i = 0; i < smi.monitor_devices().size(); ++i) {
|
||||
for (uint32_t i = 0; i < smi.monitor_devices().size(); ++i) {
|
||||
#if DEBUG
|
||||
ret = pthread_mutex_unlock(smi.monitor_devices()[i]->mutex());
|
||||
std::cout << "pthread_mutex_unlock() returned " << ret <<
|
||||
if (ret != EPERM) { // We expect to get EPERM if the lock has already
|
||||
// been released
|
||||
if (ret == 0) {
|
||||
std::cout << "WARNING: Unlocked monitor_devices lock; " <<
|
||||
"it should have already been unlocked." << std::endl;
|
||||
} else {
|
||||
std::cout << "WARNING: pthread_mutex_unlock() returned " << ret <<
|
||||
" for device " << i << " in rsmi_shut_down()" << std::endl;
|
||||
}
|
||||
}
|
||||
#else
|
||||
(void)pthread_mutex_unlock(smi.monitor_devices()[i]->mutex());
|
||||
#endif
|
||||
|
||||
Αναφορά σε νέο ζήτημα
Block a user