Seg3D  2.4
Seg3D is a free volume segmentation and processing tool developed by the NIH Center for Integrative Biomedical Computing at the University of Utah Scientific Computing and Imaging (SCI) Institute.
the_boost_thread_storage.hxx
1 /*
2  For more information, please see: http://software.sci.utah.edu
3 
4  The MIT License
5 
6  Copyright (c) 2016 Scientific Computing and Imaging Institute,
7  University of Utah.
8 
9 
10  Permission is hereby granted, free of charge, to any person obtaining a
11  copy of this software and associated documentation files (the "Software"),
12  to deal in the Software without restriction, including without limitation
13  the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  and/or sell copies of the Software, and to permit persons to whom the
15  Software is furnished to do so, subject to the following conditions:
16 
17  The above copyright notice and this permission notice shall be included
18  in all copies or substantial portions of the Software.
19 
20  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  DEALINGS IN THE SOFTWARE.
27 */
28 
29 // File : the_boost_thread_storage.hxx
30 // Author : Pavel A. Koshevoy
31 // Created : Sat Oct 25 12:35:47 MDT 2008
32 // Copyright : (C) 2004-2008 University of Utah
33 // Description : A thin wrapper for Boost thread specific storage.
34 
35 #ifndef THE_BOOST_THREAD_STORAGE_HXX_
36 #define THE_BOOST_THREAD_STORAGE_HXX_
37 
38 // local includes:
39 #include <Core/ITKCommon/ThreadUtils/the_thread_storage.hxx>
40 
41 // Boost includes:
42 #include <boost/thread/tss.hpp>
43 
44 
45 //----------------------------------------------------------------
46 // the_boost_thread_storage_t
47 //
49  public boost::thread_specific_ptr<the_thread_observer_t>,
51 {
52 public:
53  // virtual: check whether the thread storage has been initialized:
54  bool is_ready() const
55  {
56  return (boost::thread_specific_ptr<the_thread_observer_t>::get() != NULL);
57  }
58 
59  // virtual: check whether the thread has been stopped:
60  bool thread_stopped() const
61  {
62  return
63  boost::thread_specific_ptr<the_thread_observer_t>::get()->
64  thread_.stopped();
65  }
66 
67  // virtual: terminator access:
68  the_terminators_t & terminators()
69  {
70  return
71  boost::thread_specific_ptr<the_thread_observer_t>::get()->
72  thread_.terminators();
73  }
74 
75  // virtual:
76  unsigned int thread_id() const
77  {
78  return
79  boost::thread_specific_ptr<the_thread_observer_t>::get()->
80  thread_.id();
81  }
82 };
83 
84 
85 #endif // THE_BOOST_THREAD_STORAGE_HXX_
Definition: the_thread_storage.hxx:58
Definition: the_terminator.hxx:120
Definition: the_boost_thread_storage.hxx:48