DIY  3.0
data-parallel out-of-core C++ library
 All Classes Namespaces Functions Typedefs Groups Pages
no-thread.hpp
1 #ifndef DIY_NO_THREAD_HPP
2 #define DIY_NO_THREAD_HPP
3 
4 // replicates only the parts of the threading interface that we use
5 // executes everything in a single thread
6 
7 namespace diy
8 {
9  struct thread
10  {
11  thread(void (*f)(void *), void* args):
12  f_(f), args_(args) {}
13 
14  void join() { f_(args_); }
15 
16  static unsigned hardware_concurrency() { return 1; }
17 
18  void (*f_)(void*);
19  void* args_;
20  };
21 
22  struct mutex {};
23  struct fast_mutex {};
24  struct recursive_mutex {};
25 
26  template<class T>
27  struct lock_guard
28  {
29  lock_guard(T&) {}
30  };
31 
32  namespace this_thread
33  {
34  inline unsigned long int get_id() { return 0; }
35  }
36 }
37 
38 #endif
Definition: no-thread.hpp:23
Definition: no-thread.hpp:22
Definition: no-thread.hpp:24
Definition: no-thread.hpp:27
Definition: no-thread.hpp:9