summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib/thread
diff options
context:
space:
mode:
authorNicholas Corgan <nick.corgan@ettus.com>2014-07-07 15:31:33 -0700
committerNicholas Corgan <nick.corgan@ettus.com>2014-07-07 15:31:33 -0700
commit3b6ca994ca2219d3834814d3175ef6aec04b33fb (patch)
treef3b58aee799276f40317f518eb548b1fd16b0be5 /gnuradio-runtime/lib/thread
parent597b93798a804cde1783d6d2ab53b348d57c44cd (diff)
Windows compatibility fixes
* Fixed usage of Windows thread-naming API, changed minimum Windows version * Fixed MSVC usage of isnan, round
Diffstat (limited to 'gnuradio-runtime/lib/thread')
-rw-r--r--gnuradio-runtime/lib/thread/thread.cc26
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 */