libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
thread_pool_sequential.hpp
Go to the documentation of this file.
1 #ifndef LIBJMMCG_CORE_THREAD_POOL_SEQUENTIAL_HPP
2 #define LIBJMMCG_CORE_THREAD_POOL_SEQUENTIAL_HPP
3 /******************************************************************************
4 ** Copyright © 2004 by J.M.McGuiness, coder@hussar.me.uk
5 **
6 ** This library is free software; you can redistribute it and/or
7 ** modify it under the terms of the GNU Lesser General Public
8 ** License as published by the Free Software Foundation; either
9 ** version 2.1 of the License, or (at your option) any later version.
10 **
11 ** This library 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 GNU
14 ** Lesser General Public License for more details.
15 **
16 ** You should have received a copy of the GNU Lesser General Public
17 ** License along with this library; if not, write to the Free Software
18 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20 
21 #include "private_/thread_pool.hpp"
22 
23 namespace jmmcg { namespace LIBJMMCG_VER_NAMESPACE {
24 
25  /// Parallel Pixie Dust or PPD is the name of the thread library within libjmmcg.
26  /**
27  Why is it called "ppd"? It stands for "Parallel Pixie Dust", a term coined at the <a href="http://www.accu.org/">ACCU</a> by, if I recall correctly, Hubert Matthews in around 2001, whilst I was in conversation with him about thread libraries and their ability to shield a programmer from the issues of threading.
28  */
29  namespace ppd {
30 
31  /// This compatibility-pool has an unlimited size, and uses a master to execute the work.
32  /**
33  There is no threading at all in this pool. It tries to be as fast as directly executing the methods
34  on the closure_base-derived closure class. The idea of this class is that you can use it to provide both single &
35  multi-threaded implementations within your objects and code, by just changing a typedef or a trait.
36  */
37  template<
38  class P
39  >
42  public:
45  };
46 
47  /// This compatibility-pool has an unlimited size, and the "worker thread"s directly execute the work.
48  /**
49  There is no threading at all in this pool. It tries to be as fast as directly executing the methods
50  on the closure_base-derived closure class. The idea of this class is that you can use it to provide both single &
51  multi-threaded implementations within your objects and code, by just changing a typedef or a trait.
52  */
53  template<
54  class P
55  >
58  public:
60  typedef typename base_t::os_traits os_traits;
62  typedef typename base_t::pool_type pool_type;
64 
65  enum class erase_states {
69  };
70 
71  constexpr __stdcall thread_pool() FORCE_INLINE
72  : base_t() {
73  }
74  explicit __stdcall thread_pool(const pool_size_type sz) FORCE_INLINE
75  : base_t(sz) {
76  }
77 
78  template<typename ExecT>
79  static constexpr erase_states __fastcall FORCE_INLINE
80  erase(ExecT &) {
81  return erase_states::failed_to_erase;
82  }
83  };
84 
85  } } }
86 
87 #endif