STXXL  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
request_queue_impl_worker.h
Go to the documentation of this file.
1 /***************************************************************************
2  * include/stxxl/bits/io/request_queue_impl_worker.h
3  *
4  * Part of the STXXL. See http://stxxl.sourceforge.net
5  *
6  * Copyright (C) 2002 Roman Dementiev <[email protected]>
7  * Copyright (C) 2008, 2009 Andreas Beckmann <[email protected]>
8  * Copyright (C) 2009 Johannes Singler <[email protected]>
9  * Copyright (C) 2013 Timo Bingmann <[email protected]>
10  *
11  * Distributed under the Boost Software License, Version 1.0.
12  * (See accompanying file LICENSE_1_0.txt or copy at
13  * http://www.boost.org/LICENSE_1_0.txt)
14  **************************************************************************/
15 
16 #ifndef STXXL_IO_REQUEST_QUEUE_IMPL_WORKER_HEADER
17 #define STXXL_IO_REQUEST_QUEUE_IMPL_WORKER_HEADER
18 
19 #include <stxxl/bits/config.h>
20 
21 #if STXXL_STD_THREADS
22  #include <thread>
23 #elif STXXL_BOOST_THREADS
24  #include <boost/thread/thread.hpp>
25 #elif STXXL_POSIX_THREADS
26  #include <pthread.h>
27 #else
28  #error "Thread implementation not detected."
29 #endif
30 
34 
35 
37 
38 //! \addtogroup iolayer
39 //! \{
40 
42 {
43 protected:
44  enum thread_state { NOT_RUNNING, RUNNING, TERMINATING, TERMINATED };
45 
46 #if STXXL_STD_THREADS
47  typedef std::thread* thread_type;
48 #elif STXXL_BOOST_THREADS
49  typedef boost::thread* thread_type;
50 #else
51  typedef pthread_t thread_type;
52 #endif
53 
54 protected:
55  void start_thread(void* (* worker)(void*), void* arg, thread_type& t, state<thread_state>& s);
56  void stop_thread(thread_type& t, state<thread_state>& s, semaphore& sem);
57 };
58 
59 //! \}
60 
62 
63 #endif // !STXXL_IO_REQUEST_QUEUE_IMPL_WORKER_HEADER
64 // vim: et:ts=4:sw=4
#define STXXL_BEGIN_NAMESPACE
Definition: namespace.h:16
#define STXXL_END_NAMESPACE
Definition: namespace.h:17