Skip to content

Commit

Permalink
Fix TSAN issue #2 in GNA plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
vurusovs committed Apr 25, 2023
1 parent e37288f commit f7e9414
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/plugins/intel_gna/src/log/log.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "log.hpp"

namespace ov {
namespace intel_gna {
std::mutex GnaLog::mutex_;
} // namespace intel_gna
} // namespace ov
3 changes: 3 additions & 0 deletions src/plugins/intel_gna/src/log/log.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#pragma once

#include <iostream>
#include <mutex>
#include <ostream>

#include "openvino/runtime/properties.hpp"
Expand All @@ -23,6 +24,7 @@ class GnaLog {
GnaLog() = default;

static GnaLog& log(ov::log::Level log_level) {
std::lock_guard<std::mutex> guard(mutex_);
GnaLog& obj = get_instance();
obj.message_level_ = log_level;
obj << "[" << log_level << "]"
Expand All @@ -35,6 +37,7 @@ class GnaLog {

/** Log level of particular log message */
ov::log::Level message_level_ = ov::log::Level::NO;
static std::mutex mutex_;

static GnaLog& get_instance() {
static GnaLog log_obj;
Expand Down

0 comments on commit f7e9414

Please sign in to comment.