STXXL  1.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
request_queue_impl_1q.h
Go to the documentation of this file.
1 /***************************************************************************
2  * include/stxxl/bits/io/request_queue_impl_1q.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  *
10  * Distributed under the Boost Software License, Version 1.0.
11  * (See accompanying file LICENSE_1_0.txt or copy at
12  * http://www.boost.org/LICENSE_1_0.txt)
13  **************************************************************************/
14 
15 #ifndef STXXL_IO_REQUEST_QUEUE_IMPL_1Q_HEADER
16 #define STXXL_IO_REQUEST_QUEUE_IMPL_1Q_HEADER
17 
18 #include <list>
19 
22 
24 
25 //! \addtogroup reqlayer
26 //! \{
27 
28 //! Implementation of a local request queue having only one queue for both read
29 //! and write requests, thus having only one thread.
31 {
32 private:
33  typedef request_queue_impl_1q self;
34  typedef std::list<request_ptr> queue_type;
35 
38 
40  thread_type m_thread;
42 
43  static const priority_op m_priority_op = WRITE;
44 
45  static void * worker(void* arg);
46 
47 public:
48  // \param n max number of requests simultaneously submitted to disk
49  request_queue_impl_1q(int n = 1);
50 
51  // in a multi-threaded setup this does not work as intended
52  // also there were race conditions possible
53  // and actually an old value was never restored once a new one was set ...
54  // so just disable it and all it's nice implications
56  {
57  //_priority_op = op;
58  STXXL_UNUSED(op);
59  }
60  void add_request(request_ptr& req);
61  bool cancel_request(request_ptr& req);
63 };
64 
65 //! \}
66 
68 
69 #endif // !STXXL_IO_REQUEST_QUEUE_IMPL_1Q_HEADER
70 // vim: et:ts=4:sw=4
void set_priority_op(priority_op op)
Implementation of a local request queue having only one queue for both read and write requests...
std::list< request_ptr > queue_type
High-performance smart pointer used as a wrapping reference counting pointer.
Definition: counting_ptr.h:50
Implementation of request queue worker threads. Worker threads can be started by start_thread and sto...
#define STXXL_BEGIN_NAMESPACE
Definition: namespace.h:16
void STXXL_UNUSED(const U &)
Definition: unused.h:22
state< thread_state > m_thread_state
#define STXXL_END_NAMESPACE
Definition: namespace.h:17