STXXL  1.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
request_with_waiters.h
Go to the documentation of this file.
1 /***************************************************************************
2  * include/stxxl/bits/io/request_with_waiters.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 Andreas Beckmann <[email protected]>
8  *
9  * Distributed under the Boost Software License, Version 1.0.
10  * (See accompanying file LICENSE_1_0.txt or copy at
11  * http://www.boost.org/LICENSE_1_0.txt)
12  **************************************************************************/
13 
14 #ifndef STXXL_IO_REQUEST_WITH_WAITERS_HEADER
15 #define STXXL_IO_REQUEST_WITH_WAITERS_HEADER
16 
17 #include <set>
18 
21 #include <stxxl/bits/io/request.h>
22 #include <stxxl/bits/namespace.h>
23 
25 
26 //! \addtogroup reqlayer
27 //! \{
28 
29 //! Request that is aware of threads waiting for it to complete.
31 {
33  std::set<onoff_switch*> m_waiters;
34 
35 protected:
36  bool add_waiter(onoff_switch* sw);
37  void delete_waiter(onoff_switch* sw);
38  void notify_waiters();
39 
40  //! returns number of waiters
41  size_t num_waiters();
42 
43 public:
45  const completion_handler& on_cmpl,
46  file* f,
47  void* buf,
48  offset_type off,
49  size_type b,
50  request_type t)
51  : request(on_cmpl, f, buf, off, b, t)
52  { }
53 };
54 
55 //! \}
56 
58 
59 #endif // !STXXL_IO_REQUEST_WITH_WAITERS_HEADER
60 // vim: et:ts=4:sw=4
Completion handler class (Loki-style).
Request that is aware of threads waiting for it to complete.
std::set< onoff_switch * > m_waiters
Defines interface of file.
Definition: file.h:56
#define STXXL_BEGIN_NAMESPACE
Definition: namespace.h:16
stxxl::internal_size_type size_type
request_with_waiters(const completion_handler &on_cmpl, file *f, void *buf, offset_type off, size_type b, request_type t)
stxxl::external_size_type offset_type
Request object encapsulating basic properties like file and offset.
Definition: request.h:38
#define STXXL_END_NAMESPACE
Definition: namespace.h:17