MADNESS  0.10.1
thread_info.h
Go to the documentation of this file.
1 /*
2  This file is part of MADNESS.
3 
4  Copyright (C) 2007,2010 Oak Ridge National Laboratory
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 
20  For more information please contact:
21 
22  Robert J. Harrison
23  Oak Ridge National Laboratory
24  One Bethel Valley Road
25  P.O. Box 2008, MS-6367
26 
27  email: harrisonrj@ornl.gov
28  tel: 865-241-3937
29  fax: 865-572-0680
30 */
31 
32 #ifndef MADNESS_WORLD_THREAD_INFO_H__INCLUDED
33 #define MADNESS_WORLD_THREAD_INFO_H__INCLUDED
34 
35 /**
36  \file thread_info.h
37  \brief Implements thread introspection
38  \ingroup threads
39 */
40 
41 namespace madness {
42 
43  /// bitfield describing thread type
44  enum ThreadTag {
47  ThreadTag_Main = 0b0010
48  };
49 
50  namespace detail {
52  thread_local ThreadTag value = ThreadTag_NonMADNESS;
53  return value;
54  }
55  } // namespace madness::detail
56 
57  /// sets the thread tag for the thread invoking this function
58  /// @param tag thread tag for the calling thread
59  inline void set_thread_tag(ThreadTag tag) {
61  }
62 
63  /// sets the thread tag for the thread invoking this function
64  /// @param tag thread tag for the calling thread
65  inline void set_thread_tag(int tag) {
66  detail::thread_tag_accessor() = static_cast<ThreadTag>(tag);
67  }
68 
69  /// @return true if this thread is managed by MADNESS
70  inline bool is_madness_thread() {
72  }
73 
74 } // namespace madness
75 
76 #endif // MADNESS_WORLD_THREAD_INFO_H__INCLUDED
ThreadTag & thread_tag_accessor()
Definition: thread_info.h:51
File holds all helper structures necessary for the CC_Operator and CC2 class.
Definition: DFParameters.h:10
void set_thread_tag(ThreadTag tag)
Definition: thread_info.h:59
bool is_madness_thread()
Definition: thread_info.h:70
ThreadTag
bitfield describing thread type
Definition: thread_info.h:44
@ ThreadTag_MADNESS
Definition: thread_info.h:46
@ ThreadTag_Main
Definition: thread_info.h:47
@ ThreadTag_NonMADNESS
Definition: thread_info.h:45