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

Detailed Description

Queue for linuxaio_file(s)

Only one queue exists in a program, i.e. it is a singleton.

Definition at line 35 of file linuxaio_queue.h.

+ Inheritance diagram for stxxl::linuxaio_queue:
+ Collaboration diagram for stxxl::linuxaio_queue:

Public Member Functions

 linuxaio_queue (int desired_queue_length=0)
 Construct queue. Requests max number of requests simultaneously submitted to disk, 0 means as many as possible. More...
 
 ~linuxaio_queue ()
 
void add_request (request_ptr &req)
 
bool cancel_request (request_ptr &req)
 
void complete_request (request_ptr &req)
 
- Public Member Functions inherited from stxxl::request_queue
virtual ~request_queue () noexcept(false)
 
virtual void set_priority_op (priority_op p)
 

Private Types

typedef std::list< request_ptrqueue_type
 storing linuxaio_request* would drop ownership More...
 
typedef linuxaio_queue self_type
 

Private Member Functions

aio_context_t get_io_context ()
 
void handle_events (io_event *events, long num_events, bool canceled)
 
void post_requests ()
 
void suspend ()
 
void wait_requests ()
 

Static Private Member Functions

static void * post_async (void *arg)
 
static void * wait_async (void *arg)
 

Private Attributes

aio_context_t context
 OS context. More...
 
int max_events
 max number of OS requests More...
 
semaphore num_free_events
 
semaphore num_posted_requests
 
semaphore num_waiting_requests
 number of requests in waitings_requests More...
 
thread_type post_thread
 
state< thread_statepost_thread_state
 
mutex posted_mtx
 
queue_type posted_requests
 
thread_type wait_thread
 
state< thread_statewait_thread_state
 
mutex waiting_mtx
 
queue_type waiting_requests
 

Static Private Attributes

static const priority_op _priority_op = WRITE
 

Additional Inherited Members

- Public Types inherited from stxxl::request_queue
enum  priority_op { READ, WRITE, NONE }
 
- Protected Types inherited from stxxl::request_queue_impl_worker
enum  thread_state { NOT_RUNNING, RUNNING, TERMINATING, TERMINATED }
 
typedef pthread_t thread_type
 
- Protected Member Functions inherited from stxxl::request_queue_impl_worker
void start_thread (void *(*worker)(void *), void *arg, thread_type &t, state< thread_state > &s)
 
void stop_thread (thread_type &t, state< thread_state > &s, semaphore &sem)
 

Member Typedef Documentation

typedef std::list<request_ptr> stxxl::linuxaio_queue::queue_type
private

storing linuxaio_request* would drop ownership

Definition at line 46 of file linuxaio_queue.h.

Definition at line 39 of file linuxaio_queue.h.

Constructor & Destructor Documentation

stxxl::linuxaio_queue::linuxaio_queue ( int  desired_queue_length = 0)

Construct queue. Requests max number of requests simultaneously submitted to disk, 0 means as many as possible.

Definition at line 35 of file linuxaio_queue.cpp.

References context, max_events, num_free_events, post_async(), post_thread, post_thread_state, stxxl::request_queue_impl_worker::start_thread(), STXXL_MSG, STXXL_THROW_ERRNO, wait_async(), wait_thread, and wait_thread_state.

Member Function Documentation

void stxxl::linuxaio_queue::complete_request ( request_ptr req)
aio_context_t stxxl::linuxaio_queue::get_io_context ( )
inlineprivate
void stxxl::linuxaio_queue::handle_events ( io_event *  events,
long  num_events,
bool  canceled 
)
private
void * stxxl::linuxaio_queue::post_async ( void *  arg)
staticprivate
void stxxl::linuxaio_queue::suspend ( )
private
void * stxxl::linuxaio_queue::wait_async ( void *  arg)
staticprivate
void stxxl::linuxaio_queue::wait_requests ( )
private

Member Data Documentation

const priority_op stxxl::linuxaio_queue::_priority_op = WRITE
staticprivate

Definition at line 70 of file linuxaio_queue.h.

aio_context_t stxxl::linuxaio_queue::context
private

OS context.

Definition at line 43 of file linuxaio_queue.h.

Referenced by linuxaio_queue(), post_requests(), wait_requests(), and ~linuxaio_queue().

int stxxl::linuxaio_queue::max_events
private

max number of OS requests

Definition at line 54 of file linuxaio_queue.h.

Referenced by linuxaio_queue(), post_requests(), and wait_requests().

semaphore stxxl::linuxaio_queue::num_free_events
private

Definition at line 56 of file linuxaio_queue.h.

Referenced by cancel_request(), handle_events(), linuxaio_queue(), and post_requests().

semaphore stxxl::linuxaio_queue::num_posted_requests
private
semaphore stxxl::linuxaio_queue::num_waiting_requests
private

number of requests in waitings_requests

Definition at line 56 of file linuxaio_queue.h.

Referenced by add_request(), cancel_request(), post_requests(), and ~linuxaio_queue().

thread_type stxxl::linuxaio_queue::post_thread
private

Definition at line 59 of file linuxaio_queue.h.

Referenced by linuxaio_queue(), and ~linuxaio_queue().

state<thread_state> stxxl::linuxaio_queue::post_thread_state
private
mutex stxxl::linuxaio_queue::posted_mtx
private

Definition at line 50 of file linuxaio_queue.h.

Referenced by cancel_request(), and post_requests().

queue_type stxxl::linuxaio_queue::posted_requests
private

Definition at line 51 of file linuxaio_queue.h.

Referenced by cancel_request(), and post_requests().

thread_type stxxl::linuxaio_queue::wait_thread
private

Definition at line 59 of file linuxaio_queue.h.

Referenced by linuxaio_queue(), and ~linuxaio_queue().

state<thread_state> stxxl::linuxaio_queue::wait_thread_state
private

Definition at line 60 of file linuxaio_queue.h.

Referenced by linuxaio_queue(), wait_async(), wait_requests(), and ~linuxaio_queue().

mutex stxxl::linuxaio_queue::waiting_mtx
private

Definition at line 50 of file linuxaio_queue.h.

Referenced by add_request(), cancel_request(), and post_requests().

queue_type stxxl::linuxaio_queue::waiting_requests
private

Definition at line 51 of file linuxaio_queue.h.

Referenced by add_request(), cancel_request(), and post_requests().


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