Thrill
0.1
|
Implementation of a local request queue having two queues, one for read and one for write requests, thus having two threads. This is the default implementation.
Definition at line 34 of file request_queue_impl_qwqr.hpp.
#include <request_queue_impl_qwqr.hpp>
Public Member Functions | |
request_queue_impl_qwqr (int n=1) | |
~request_queue_impl_qwqr () | |
void | add_request (request_ptr &req) final |
bool | cancel_request (request_ptr &req) final |
void | set_priority_op (const priority_op &op) final |
Public Member Functions inherited from request_queue | |
request_queue ()=default | |
request_queue (const request_queue &)=delete | |
non-copyable: delete copy-constructor More... | |
request_queue (request_queue &&)=default | |
move-constructor: default More... | |
virtual | ~request_queue () |
request_queue & | operator= (const request_queue &)=delete |
non-copyable: delete assignment operator More... | |
request_queue & | operator= (request_queue &&)=default |
move-assignment operator: default More... | |
Private Types | |
using | queue_type = std::list< request_ptr > |
using | self = request_queue_impl_qwqr |
Static Private Member Functions | |
static void * | worker (void *arg) |
Private Attributes | |
std::mutex | read_mutex_ |
queue_type | read_queue_ |
tlx::semaphore | sem_ |
std::thread | thread_ |
shared_state< thread_state > | thread_state_ |
std::mutex | write_mutex_ |
queue_type | write_queue_ |
Static Private Attributes | |
static constexpr bool | debug = false |
static const priority_op | priority_op_ = WRITE |
Additional Inherited Members | |
Public Types inherited from request_queue | |
enum | priority_op { READ, WRITE, NONE } |
Protected Types inherited from request_queue_impl_worker | |
enum | thread_state { NOT_RUNNING, RUNNING, TERMINATING, TERMINATED } |
Protected Member Functions inherited from request_queue_impl_worker | |
void | start_thread (void *(*worker)(void *), void *arg, std::thread &t, shared_state< thread_state > &s) |
void | stop_thread (std::thread &t, shared_state< thread_state > &s, tlx::semaphore &sem) |
|
private |
Definition at line 40 of file request_queue_impl_qwqr.hpp.
|
private |
Definition at line 39 of file request_queue_impl_qwqr.hpp.
|
explicit |
Definition at line 48 of file request_queue_impl_qwqr.cpp.
References request_queue_impl_worker::start_thread(), request_queue_impl_qwqr::thread_, request_queue_impl_qwqr::thread_state_, tlx::unused(), and request_queue_impl_qwqr::worker().
Definition at line 150 of file request_queue_impl_qwqr.cpp.
References request_queue_impl_qwqr::sem_, request_queue_impl_worker::stop_thread(), request_queue_impl_qwqr::thread_, and request_queue_impl_qwqr::thread_state_.
|
finalvirtual |
Implements request_queue.
Definition at line 61 of file request_queue_impl_qwqr.cpp.
References CountingPtr< Type, Deleter >::empty(), FOXXLL_THROW_INVALID_ARGUMENT, CountingPtr< Type, Deleter >::get(), request_interface::READ, request_queue_impl_qwqr::read_mutex_, request_queue_impl_qwqr::read_queue_, request_queue_impl_worker::RUNNING, request_queue_impl_qwqr::sem_, Semaphore::signal(), request_queue_impl_qwqr::thread_state_, TLX_LOG1, request_queue_impl_qwqr::write_mutex_, and request_queue_impl_qwqr::write_queue_.
|
finalvirtual |
Implements request_queue.
Definition at line 110 of file request_queue_impl_qwqr.cpp.
References CountingPtr< Type, Deleter >::empty(), FOXXLL_THROW_INVALID_ARGUMENT, CountingPtr< Type, Deleter >::get(), request_interface::READ, request_queue_impl_qwqr::read_mutex_, request_queue_impl_qwqr::read_queue_, request_queue_impl_worker::RUNNING, request_queue_impl_qwqr::sem_, request_queue_impl_qwqr::thread_state_, TLX_LOG1, Semaphore::wait(), request_queue_impl_qwqr::write_mutex_, and request_queue_impl_qwqr::write_queue_.
|
finalvirtual |
Reimplemented from request_queue.
Definition at line 55 of file request_queue_impl_qwqr.cpp.
References tlx::unused().
|
staticprivate |
Definition at line 155 of file request_queue_impl_qwqr.cpp.
References CountingPtr< Type, Deleter >::get(), request_queue::NONE, request_queue::READ, request_queue_impl_qwqr::sem_, request_queue_impl_worker::TERMINATED, request_queue_impl_worker::TERMINATING, TLX_LOG, Semaphore::wait(), and request_queue::WRITE.
Referenced by request_queue_impl_qwqr::request_queue_impl_qwqr().
|
staticprivate |
Definition at line 36 of file request_queue_impl_qwqr.hpp.
|
staticprivate |
Definition at line 51 of file request_queue_impl_qwqr.hpp.
|
private |
Definition at line 43 of file request_queue_impl_qwqr.hpp.
Referenced by request_queue_impl_qwqr::add_request(), and request_queue_impl_qwqr::cancel_request().
|
private |
Definition at line 45 of file request_queue_impl_qwqr.hpp.
Referenced by request_queue_impl_qwqr::add_request(), and request_queue_impl_qwqr::cancel_request().
|
private |
Definition at line 49 of file request_queue_impl_qwqr.hpp.
Referenced by request_queue_impl_qwqr::add_request(), request_queue_impl_qwqr::cancel_request(), request_queue_impl_qwqr::worker(), and request_queue_impl_qwqr::~request_queue_impl_qwqr().
|
private |
Definition at line 48 of file request_queue_impl_qwqr.hpp.
Referenced by request_queue_impl_qwqr::request_queue_impl_qwqr(), and request_queue_impl_qwqr::~request_queue_impl_qwqr().
|
private |
Definition at line 47 of file request_queue_impl_qwqr.hpp.
Referenced by request_queue_impl_qwqr::add_request(), request_queue_impl_qwqr::cancel_request(), request_queue_impl_qwqr::request_queue_impl_qwqr(), and request_queue_impl_qwqr::~request_queue_impl_qwqr().
|
private |
Definition at line 42 of file request_queue_impl_qwqr.hpp.
Referenced by request_queue_impl_qwqr::add_request(), and request_queue_impl_qwqr::cancel_request().
|
private |
Definition at line 44 of file request_queue_impl_qwqr.hpp.
Referenced by request_queue_impl_qwqr::add_request(), and request_queue_impl_qwqr::cancel_request().