Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ThreadNaming.hh
1 #ifndef __ThreadNaming_HH__
2 #define __ThreadNaming_HH__
3 
4 //#include <bias_config.h>
5 
6 
7 /** \ingroup g_utils
8 \file ThreadNaming.hh
9 \brief utility function to assign "names" to threads, actually WIN32 only.
10 Very useful for debugging multiple threads.
11 
12 code inspired by http://www.highprogrammer.com/alan/windev/visualstudio.html
13 
14 \author Jan Woetzel.
15 **/
16 
17 
18 #if !defined(WIN32)
19 //#if 0 // cygwin testing
20 # error setting thread name is implemented for WIN32, only. Use/include header only there. Please ifdef your code. (JW)
21 #else
22 
23 namespace BIAS {
24 
25  /** set the name of a thread.
26  Useful for debugging in WIN32 with MS Visual Studio.
27  typical usage, e.g. as first command in wxThread::Entry()
28  BIAS::SetThreadName(this->GetId(), "PTGS_JW");
29  @author Jan Woetzel 2005 */
30  void
31  /* BIASDebug_EXPORT */
32  SetThreadName(const unsigned long dwThreadID, const char* szThreadName );
33 } // namespace BIAS
34 
35 #endif
36 
37 #endif // __ThreadNaming_HH__