Thrill
0.1
|
Implementation of a local request queue having only one queue for both read and write requests, thus having only one thread.
Definition at line 32 of file request_queue_impl_1q.hpp.
#include <request_queue_impl_1q.hpp>
Public Member Functions | |
request_queue_impl_1q (int n=1) | |
~request_queue_impl_1q () | |
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... | |
virtual void | set_priority_op (const priority_op &p) |
Private Types | |
using | queue_type = std::list< request_ptr > |
using | self = request_queue_impl_1q |
Static Private Member Functions | |
static void * | worker (void *arg) |
Private Attributes | |
queue_type | queue_ |
std::mutex | queue_mutex_ |
tlx::semaphore | sem_ |
std::thread | thread_ |
shared_state< thread_state > | thread_state_ |
Static Private Attributes | |
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 36 of file request_queue_impl_1q.hpp.
|
private |
Definition at line 35 of file request_queue_impl_1q.hpp.
|
explicit |
Definition at line 49 of file request_queue_impl_1q.cpp.
References request_queue_impl_worker::start_thread(), request_queue_impl_1q::thread_, request_queue_impl_1q::thread_state_, tlx::unused(), and request_queue_impl_1q::worker().
Definition at line 117 of file request_queue_impl_1q.cpp.
References request_queue_impl_1q::sem_, request_queue_impl_worker::stop_thread(), request_queue_impl_1q::thread_, and request_queue_impl_1q::thread_state_.
|
finalvirtual |
Implements request_queue.
Definition at line 62 of file request_queue_impl_1q.cpp.
References CountingPtr< Type, Deleter >::empty(), FOXXLL_THROW_INVALID_ARGUMENT, CountingPtr< Type, Deleter >::get(), request_queue_impl_1q::queue_, request_queue_impl_1q::queue_mutex_, request_queue_impl_worker::RUNNING, request_queue_impl_1q::sem_, Semaphore::signal(), request_queue_impl_1q::thread_state_, and TLX_LOG1.
|
finalvirtual |
Implements request_queue.
Definition at line 90 of file request_queue_impl_1q.cpp.
References CountingPtr< Type, Deleter >::empty(), FOXXLL_THROW_INVALID_ARGUMENT, CountingPtr< Type, Deleter >::get(), request_queue_impl_1q::queue_, request_queue_impl_1q::queue_mutex_, request_queue_impl_worker::RUNNING, request_queue_impl_1q::sem_, request_queue_impl_1q::thread_state_, TLX_LOG1, and Semaphore::wait().
|
final |
Definition at line 56 of file request_queue_impl_1q.cpp.
References tlx::unused().
|
staticprivate |
Definition at line 122 of file request_queue_impl_1q.cpp.
References CountingPtr< Type, Deleter >::get(), request_queue_impl_1q::sem_, request_queue_impl_worker::TERMINATED, request_queue_impl_worker::TERMINATING, and Semaphore::wait().
Referenced by request_queue_impl_1q::request_queue_impl_1q().
|
staticprivate |
Definition at line 45 of file request_queue_impl_1q.hpp.
|
private |
Definition at line 39 of file request_queue_impl_1q.hpp.
Referenced by request_queue_impl_1q::add_request(), and request_queue_impl_1q::cancel_request().
|
private |
Definition at line 38 of file request_queue_impl_1q.hpp.
Referenced by request_queue_impl_1q::add_request(), and request_queue_impl_1q::cancel_request().
|
private |
Definition at line 43 of file request_queue_impl_1q.hpp.
Referenced by request_queue_impl_1q::add_request(), request_queue_impl_1q::cancel_request(), request_queue_impl_1q::worker(), and request_queue_impl_1q::~request_queue_impl_1q().
|
private |
Definition at line 42 of file request_queue_impl_1q.hpp.
Referenced by request_queue_impl_1q::request_queue_impl_1q(), and request_queue_impl_1q::~request_queue_impl_1q().
|
private |
Definition at line 41 of file request_queue_impl_1q.hpp.
Referenced by request_queue_impl_1q::add_request(), request_queue_impl_1q::cancel_request(), request_queue_impl_1q::request_queue_impl_1q(), and request_queue_impl_1q::~request_queue_impl_1q().