diff options
Diffstat (limited to 'gnuradio-runtime/lib/thread/thread.cc')
-rw-r--r-- | gnuradio-runtime/lib/thread/thread.cc | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/gnuradio-runtime/lib/thread/thread.cc b/gnuradio-runtime/lib/thread/thread.cc index e393ae5438..483dfed493 100644 --- a/gnuradio-runtime/lib/thread/thread.cc +++ b/gnuradio-runtime/lib/thread/thread.cc @@ -120,21 +120,14 @@ namespace gr { DWORD dwFlags; // Reserved for future use, must be zero } THREADNAME_INFO; #pragma pack(pop) - void - set_thread_name(gr_thread_t thread, std::string name) + static void + _set_thread_name(gr_thread_t thread, const char* name, DWORD dwThreadId) { const DWORD SET_THREAD_NAME_EXCEPTION = 0x406D1388; - DWORD dwThreadId = GetThreadId(thread); - if (dwThreadId == 0) - return; - - if (name.empty()) - name = boost::str(boost::format("thread %lu") % dwThreadId); - THREADNAME_INFO info; info.dwType = 0x1000; - info.szName = name.c_str(); + info.szName = name; info.dwThreadID = dwThreadId; info.dwFlags = 0; @@ -147,6 +140,19 @@ namespace gr { } } + void + set_thread_name(gr_thread_t thread, std::string name) + { + DWORD dwThreadId = GetThreadId(thread); + if (dwThreadId == 0) + return; + + if (name.empty()) + name = boost::str(boost::format("thread %lu") % dwThreadId); + + _set_thread_name(thread, name.c_str(), dwThreadId); + } + } /* namespace thread */ } /* namespace gr */ |