Stxxl  1.4.0
include/stxxl/bits/io/request_with_waiters.h
Go to the documentation of this file.
00001 /***************************************************************************
00002  *  include/stxxl/bits/io/request_with_waiters.h
00003  *
00004  *  Part of the STXXL. See http://stxxl.sourceforge.net
00005  *
00006  *  Copyright (C) 2002 Roman Dementiev <dementiev@mpi-sb.mpg.de>
00007  *  Copyright (C) 2008 Andreas Beckmann <beckmann@cs.uni-frankfurt.de>
00008  *
00009  *  Distributed under the Boost Software License, Version 1.0.
00010  *  (See accompanying file LICENSE_1_0.txt or copy at
00011  *  http://www.boost.org/LICENSE_1_0.txt)
00012  **************************************************************************/
00013 
00014 #ifndef STXXL_IO__REQUEST_WITH_WAITERS_H_
00015 #define STXXL_IO__REQUEST_WITH_WAITERS_H_
00016 
00017 #include <set>
00018 
00019 #include <stxxl/bits/common/mutex.h>
00020 #include <stxxl/bits/common/switch.h>
00021 #include <stxxl/bits/io/request_interface.h>
00022 
00023 
00024 __STXXL_BEGIN_NAMESPACE
00025 
00026 //! \addtogroup fileimpl
00027 //! \{
00028 
00029 //! \brief Request that is aware of threads waiting for it to complete.
00030 class request_with_waiters : virtual public request_interface
00031 {
00032     mutex waiters_mutex;
00033     std::set<onoff_switch *> waiters;
00034 
00035 protected:
00036     bool add_waiter(onoff_switch * sw);
00037     void delete_waiter(onoff_switch * sw);
00038     void notify_waiters();
00039     /*
00040     int nwaiters();             // returns number of waiters
00041     */
00042 };
00043 
00044 //! \}
00045 
00046 __STXXL_END_NAMESPACE
00047 
00048 #endif // !STXXL_IO__REQUEST_WITH_WAITERS_H_
00049 // vim: et:ts=4:sw=4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines