Shared mutex fixes and improvements

* Don't make different shared memory mutexes for different users
* Don't delete (unlink) the shared mutex file if the mutex
  initialization fails. This may mess up other processes that
  are using it. Instead, print a message on how to resolve the
  situation, and then throw an error.

  Note, this situation comes up when debug builds (usually)
  either assert() or otherwise end execution without a proper
  clean up.
* Remove cpplint from shared_mutex code

Change-Id: I5f8ca6150cac5c2405fb97007516da345093f966
This commit is contained in:
Chris Freehill
2020-04-06 17:08:33 -05:00
parent fd79e5c161
commit 52196caaee
5 changed files with 41 additions and 40 deletions
-5
View File
@@ -64,10 +64,7 @@
#include "rocm_smi/rocm_smi_exception.h"
#include "rocm_smi/rocm_smi_utils.h"
#include "rocm_smi/rocm_smi_kfd.h"
extern "C" {
#include "shared_mutex.h" // NOLINT
};
namespace amd {
namespace smi {
@@ -474,8 +471,6 @@ Device::Device(std::string p, RocmSMI_env_vars const *e) : path_(p), env_(e) {
std::string m_name("/rocm_smi_");
m_name += dev;
m_name += '_';
m_name += std::to_string(geteuid());
mutex_ = shared_mutex_init(m_name.c_str(), 0777);