STXXL
1.4.1
|
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.
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 () |
virtual void | set_priority_op (priority_op p) |
Private Types | |
typedef std::list< request_ptr > | queue_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_state > | post_thread_state |
mutex | posted_mtx |
queue_type | posted_requests |
thread_type | wait_thread |
state< thread_state > | wait_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) |
|
private |
storing linuxaio_request* would drop ownership
Definition at line 46 of file linuxaio_queue.h.
|
private |
Definition at line 39 of file linuxaio_queue.h.
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.
stxxl::linuxaio_queue::~linuxaio_queue | ( | ) |
Definition at line 69 of file linuxaio_queue.cpp.
References context, num_posted_requests, num_waiting_requests, post_thread, post_thread_state, stxxl::request_queue_impl_worker::stop_thread(), wait_thread, and wait_thread_state.
|
virtual |
Implements stxxl::request_queue.
Definition at line 76 of file linuxaio_queue.cpp.
References stxxl::counting_ptr< Type >::empty(), stxxl::counting_ptr< Type >::get(), num_waiting_requests, post_thread_state, stxxl::request_queue_impl_worker::RUNNING, STXXL_ERRMSG, STXXL_THROW_INVALID_ARGUMENT, waiting_mtx, and waiting_requests.
|
virtual |
Implements stxxl::request_queue.
Definition at line 91 of file linuxaio_queue.cpp.
References _STXXL_FORCE_SEQUENTIAL, stxxl::counting_ptr< Type >::empty(), stxxl::find(), stxxl::counting_ptr< Type >::get(), num_free_events, num_posted_requests, num_waiting_requests, post_thread_state, posted_mtx, posted_requests, stxxl::request_queue_impl_worker::RUNNING, STXXL_ERRMSG, STXXL_THROW_INVALID_ARGUMENT, waiting_mtx, and waiting_requests.
Referenced by stxxl::linuxaio_request::cancel().
void stxxl::linuxaio_queue::complete_request | ( | request_ptr & | req | ) |
|
inlineprivate |
Definition at line 80 of file linuxaio_queue.h.
Referenced by stxxl::linuxaio_request::cancel_aio(), and stxxl::linuxaio_request::post().
|
private |
Definition at line 206 of file linuxaio_queue.cpp.
References stxxl::request_interface::completed(), num_free_events, and num_posted_requests.
Referenced by stxxl::linuxaio_request::cancel_aio(), post_requests(), and wait_requests().
|
staticprivate |
Definition at line 249 of file linuxaio_queue.cpp.
References post_thread_state, stxxl::state< ValueType >::set_to(), and stxxl::request_queue_impl_worker::TERMINATED.
Referenced by linuxaio_queue().
|
private |
Definition at line 147 of file linuxaio_queue.cpp.
References context, stxxl::counting_ptr< Type >::get(), handle_events(), max_events, num_free_events, num_posted_requests, num_waiting_requests, post_thread_state, posted_mtx, posted_requests, STXXL_THROW_ERRNO, stxxl::request_queue_impl_worker::TERMINATING, stxxl::scoped_mutex_lock::unlock(), waiting_mtx, and waiting_requests.
|
private |
|
staticprivate |
Definition at line 265 of file linuxaio_queue.cpp.
References stxxl::state< ValueType >::set_to(), stxxl::request_queue_impl_worker::TERMINATED, and wait_thread_state.
Referenced by linuxaio_queue().
|
private |
Definition at line 220 of file linuxaio_queue.cpp.
References context, handle_events(), max_events, num_posted_requests, STXXL_THROW_ERRNO, stxxl::request_queue_impl_worker::TERMINATING, and wait_thread_state.
|
staticprivate |
Definition at line 70 of file linuxaio_queue.h.
|
private |
OS context.
Definition at line 43 of file linuxaio_queue.h.
Referenced by linuxaio_queue(), post_requests(), wait_requests(), and ~linuxaio_queue().
|
private |
max number of OS requests
Definition at line 54 of file linuxaio_queue.h.
Referenced by linuxaio_queue(), post_requests(), and wait_requests().
|
private |
Definition at line 56 of file linuxaio_queue.h.
Referenced by cancel_request(), handle_events(), linuxaio_queue(), and post_requests().
|
private |
Definition at line 56 of file linuxaio_queue.h.
Referenced by cancel_request(), handle_events(), post_requests(), wait_requests(), and ~linuxaio_queue().
|
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().
|
private |
Definition at line 59 of file linuxaio_queue.h.
Referenced by linuxaio_queue(), and ~linuxaio_queue().
|
private |
Definition at line 60 of file linuxaio_queue.h.
Referenced by add_request(), cancel_request(), linuxaio_queue(), post_async(), post_requests(), and ~linuxaio_queue().
|
private |
Definition at line 50 of file linuxaio_queue.h.
Referenced by cancel_request(), and post_requests().
|
private |
Definition at line 51 of file linuxaio_queue.h.
Referenced by cancel_request(), and post_requests().
|
private |
Definition at line 59 of file linuxaio_queue.h.
Referenced by linuxaio_queue(), and ~linuxaio_queue().
|
private |
Definition at line 60 of file linuxaio_queue.h.
Referenced by linuxaio_queue(), wait_async(), wait_requests(), and ~linuxaio_queue().
|
private |
Definition at line 50 of file linuxaio_queue.h.
Referenced by add_request(), cancel_request(), and post_requests().
|
private |
Definition at line 51 of file linuxaio_queue.h.
Referenced by add_request(), cancel_request(), and post_requests().