STXXL  1.4-dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
stxxl::request_with_waiters Class Reference

Detailed Description

Request that is aware of threads waiting for it to complete.

Definition at line 30 of file request_with_waiters.h.

+ Inheritance diagram for stxxl::request_with_waiters:
+ Collaboration diagram for stxxl::request_with_waiters:

Public Member Functions

 request_with_waiters (const completion_handler &on_cmpl, file *f, void *buf, offset_type off, size_type b, request_type t)
 
- Public Member Functions inherited from stxxl::request
 request (const completion_handler &on_compl, file *file, void *buffer, offset_type offset, size_type bytes, request_type type)
 
virtual ~request ()
 
void check_alignment () const
 
void check_errors ()
 Rises an exception if there were error with the I/O. More...
 
void error_occured (const char *msg)
 Inform the request object that an error occurred during the I/O execution. More...
 
void error_occured (const std::string &msg)
 Inform the request object that an error occurred during the I/O execution. More...
 
void * get_buffer () const
 
fileget_file () const
 
offset_type get_offset () const
 
size_type get_size () const
 
request_type get_type () const
 
virtual const char * io_type () const
 Identifies the type of I/O implementation. More...
 
std::ostream & print (std::ostream &out) const
 Dumps properties of a request. More...
 
- Public Member Functions inherited from stxxl::request_interface
virtual ~request_interface ()
 
virtual bool cancel ()=0
 Cancel a request. More...
 
virtual bool poll ()=0
 Polls the status of the request. More...
 
virtual void wait (bool measure_time=true)=0
 Suspends calling thread until completion of the request. More...
 
- Public Member Functions inherited from stxxl::atomic_counted_object
 atomic_counted_object ()
 new objects have zero reference count More...
 
 atomic_counted_object (const atomic_counted_object &)
 coping still creates a new object with zero reference count More...
 
 ~atomic_counted_object ()
 
bool dec_reference () const
 Call whenever resetting (i.e. overwriting) a pointer to the object. IMPORTANT: In case of self-assignment, call AFTER inc_reference(). More...
 
unsigned_type get_reference_count () const
 Return the number of references to this object (for debugging) More...
 
void inc_reference () const
 Call whenever setting a pointer to the object. More...
 
atomic_counted_objectoperator= (const atomic_counted_object &)
 assignment operator, leaves pointers unchanged More...
 
bool unique () const
 Test if the counted_object is referenced by only one counting_ptr. More...
 

Protected Member Functions

bool add_waiter (onoff_switch *sw)
 
void delete_waiter (onoff_switch *sw)
 
void notify_waiters ()
 
size_t num_waiters ()
 returns number of waiters More...
 
- Protected Member Functions inherited from stxxl::request
void check_nref (bool after=false)
 
- Protected Member Functions inherited from stxxl::request_interface
virtual void completed (bool canceled)=0
 

Private Attributes

std::set< onoff_switch * > m_waiters
 
mutex m_waiters_mutex
 

Additional Inherited Members

- Public Types inherited from stxxl::request_interface
typedef stxxl::external_size_type offset_type
 
enum  request_type { READ, WRITE }
 
typedef stxxl::internal_size_type size_type
 
- Protected Attributes inherited from stxxl::request
void * m_buffer
 
size_type m_bytes
 
compat_unique_ptr
< stxxl::io_error >::result 
m_error
 
filem_file
 
offset_type m_offset
 
completion_handler m_on_complete
 
request_type m_type
 

Constructor & Destructor Documentation

stxxl::request_with_waiters::request_with_waiters ( const completion_handler on_cmpl,
file f,
void *  buf,
offset_type  off,
size_type  b,
request_type  t 
)
inline

Definition at line 44 of file request_with_waiters.h.

Member Function Documentation

bool stxxl::request_with_waiters::add_waiter ( onoff_switch sw)
protectedvirtual

Implements stxxl::request_interface.

Definition at line 24 of file request_with_waiters.cpp.

void stxxl::request_with_waiters::delete_waiter ( onoff_switch sw)
protectedvirtual

Implements stxxl::request_interface.

Definition at line 42 of file request_with_waiters.cpp.

void stxxl::request_with_waiters::notify_waiters ( )
protectedvirtual

Implements stxxl::request_interface.

Definition at line 48 of file request_with_waiters.cpp.

References _STXXL_FORCE_SEQUENTIAL, and stxxl::for_each().

size_t stxxl::request_with_waiters::num_waiters ( )
protected

returns number of waiters

Definition at line 57 of file request_with_waiters.cpp.

Member Data Documentation

std::set<onoff_switch*> stxxl::request_with_waiters::m_waiters
private

Definition at line 33 of file request_with_waiters.h.

mutex stxxl::request_with_waiters::m_waiters_mutex
private

Definition at line 32 of file request_with_waiters.h.


The documentation for this class was generated from the following files: