libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
pool_thread.hpp
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright © 2004 by J.M.McGuiness, coder@hussar.me.uk
3 **
4 ** This library is free software; you can redistribute it and/or
5 ** modify it under the terms of the GNU Lesser General Public
6 ** License as published by the Free Software Foundation; either
7 ** version 2.1 of the License, or (at your option) any later version.
8 **
9 ** This library is distributed in the hope that it will be useful,
10 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 ** Lesser General Public License for more details.
13 **
14 ** You should have received a copy of the GNU Lesser General Public
15 ** License along with this library; if not, write to the Free Software
16 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 
19 namespace jmmcg { namespace ppd { namespace pool { namespace thread_types {
20 
21  template<class WQ>
23  public:
25  typedef typename base_t::os_traits os_traits;
27  typedef typename os_traits::lock_traits lock_traits;
32 
33  __stdcall steal(exit_requested_type &, signalled_work_queue_type &) noexcept(true) {}
34 
35  private:
36  typename thread_traits::api_params_type::states __fastcall execute() {
38  }
39  };
40 
41  template<class WQ>
44  public:
46  typedef typename base_t::os_traits os_traits;
48  typedef typename os_traits::lock_traits lock_traits;
53 
55  ~steal() noexcept(true);
56 
59  }
60 
61  private:
64 
65  typename thread_traits::api_params_type::states __fastcall process() noexcept(false);
66  };
67 
68  template<class WQ>
71  public:
73  typedef typename base_t::os_traits os_traits;
75  typedef typename os_traits::lock_traits lock_traits;
79 
82  }
83 
84  private:
85  typename thread_traits::api_params_type::states __fastcall process() noexcept(true) {
87  }
88  };
89 
90  template<class WQ>
93  public:
95  typedef typename base_t::os_traits os_traits;
97  typedef typename os_traits::lock_traits lock_traits;
101 
102  __stdcall slave(exit_requested_type &exit_requested, typename signalled_work_queue_type::value_type &wk) noexcept(true);
103  ~slave() noexcept(true);
104 
105  private:
107 
108  typename thread_traits::api_params_type::states __fastcall process() noexcept(false);
109  };
110 
111  /// You can report back exceptions from this thread wrapper type. Oh - and make sure you construct the execution context too (because you get the exceptions through that type).
112  template<class WQ>
115  public:
117  typedef typename base_t::os_traits os_traits;
119  typedef typename os_traits::lock_traits lock_traits;
123 
124  __stdcall steal(exit_requested_type &, signalled_work_queue_type &) noexcept(true) {}
125 
126  private:
127  typename thread_traits::api_params_type::states __fastcall process() noexcept(true) {
129  }
130  };
131 
132  /// You can report back exceptions from this thread wrapper type. Oh - and make sure you construct the execution context too (because you get the exceptions through that type).
133  template<class WQ>
136  public:
138  typedef typename base_t::os_traits os_traits;
140  typedef typename os_traits::lock_traits lock_traits;
145 
146  __stdcall steal(exit_requested_type &, signalled_work_queue_type &) noexcept(true);
147  ~steal() noexcept(true);
148 
151  }
152 
153  private:
156 
157  typename thread_traits::api_params_type::states __fastcall process() noexcept(false);
158  };
159 
160  /**
161  \todo JMG: Looks like this needs completing, as some fns are undefined! Maybe not used...
162  */
163  template<class WQ>
166  public:
168  typedef typename base_t::os_traits os_traits;
170  typedef typename os_traits::lock_traits lock_traits;
174 
177  }
178 
179  private:
181 
182  typename thread_traits::api_params_type::states __fastcall process() noexcept(true) {
184  }
185  };
186 
187  template<class WQ>
190  public:
192  typedef typename base_t::os_traits os_traits;
194  typedef typename os_traits::lock_traits lock_traits;
198 
199  __stdcall slave(exit_requested_type &exit_requested, typename signalled_work_queue_type::value_type &wk) noexcept(true);
200  ~slave() noexcept(true);
201 
202  private:
204 
205  typename thread_traits::api_params_type::states __fastcall process() noexcept(false);
206  };
207 
208 } } } }
209 
210 #include "pool_thread_impl.hpp"