fixing clang error
Этот коммит содержится в:
@@ -1,6 +1,7 @@
|
||||
#ifndef SRC_CORE_TRACE_BUFFER_H_
|
||||
#define SRC_CORE_TRACE_BUFFER_H_
|
||||
|
||||
#include <atomic>
|
||||
#include <list>
|
||||
#include <mutex>
|
||||
#include <pthread.h>
|
||||
@@ -66,7 +67,7 @@ class TraceBuffer {
|
||||
};
|
||||
|
||||
TraceBuffer(const char* name, uint32_t size, flush_prm_t* flush_prm_arr, uint32_t flush_prm_count) :
|
||||
is_flushed_(ATOMIC_FLAG_INIT)
|
||||
is_flushed_(false)
|
||||
{
|
||||
name_ = strdup(name);
|
||||
size_ = size;
|
||||
@@ -108,7 +109,7 @@ class TraceBuffer {
|
||||
private:
|
||||
void flush_buf() {
|
||||
std::lock_guard<mutex_t> lck(mutex_);
|
||||
const bool is_flushed = atomic_flag_test_and_set_explicit(&is_flushed_, std::memory_order_acquire);
|
||||
const bool is_flushed = is_flushed_.exchange(true, std::memory_order_acquire);
|
||||
|
||||
if (is_flushed == false) {
|
||||
for (flush_prm_t* prm = flush_prm_arr_; prm < flush_prm_arr_ + flush_prm_count_; prm++) {
|
||||
@@ -183,7 +184,7 @@ class TraceBuffer {
|
||||
|
||||
flush_prm_t* flush_prm_arr_;
|
||||
uint32_t flush_prm_count_;
|
||||
volatile std::atomic_flag is_flushed_;
|
||||
volatile std::atomic<bool> is_flushed_;
|
||||
|
||||
pthread_t work_thread_;
|
||||
pthread_mutex_t work_mutex_;
|
||||
|
||||
@@ -64,8 +64,10 @@ THE SOFTWARE.
|
||||
|
||||
static thread_local std::stack<std::string> message_stack;
|
||||
|
||||
#if 0
|
||||
static inline uint32_t GetPid() { return syscall(__NR_getpid); }
|
||||
static inline uint32_t GetTid() { return syscall(__NR_gettid); }
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Library errors enumaration
|
||||
|
||||
@@ -225,7 +225,7 @@ class HsaRsrcFactory {
|
||||
|
||||
static void Destroy() {
|
||||
std::lock_guard<mutex_t> lck(mutex_);
|
||||
if (instance_) delete instance_;
|
||||
if (instance_) delete instance_.load();
|
||||
instance_ = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ class Logger {
|
||||
|
||||
static void Destroy() {
|
||||
std::lock_guard<mutex_t> lck(mutex_);
|
||||
if (instance_ != NULL) delete instance_;
|
||||
if (instance_ != NULL) delete instance_.load();
|
||||
instance_ = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -251,7 +251,7 @@ void mark_api_callback(
|
||||
entry->pid = GetPid();
|
||||
entry->tid = GetTid();
|
||||
entry->data = {};
|
||||
entry->name = name;
|
||||
entry->name = strdup(name);
|
||||
entry->ptr = NULL;
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ void hip_api_flush_cb(hip_api_trace_entry_t* entry) {
|
||||
fprintf(hip_api_file_handle, "%s()\n", oss.str().c_str());
|
||||
}
|
||||
} else {
|
||||
fprintf(hip_api_file_handle, "%s(%s)\n", oss.str().c_str(), entry->name);
|
||||
fprintf(hip_api_file_handle, "%s(name(%s))\n", oss.str().c_str(), entry->name);
|
||||
}
|
||||
|
||||
fflush(hip_api_file_handle);
|
||||
|
||||
Ссылка в новой задаче
Block a user