SObjectizer  5.8
Loading...
Searching...
No Matches
so_5::disp::mpmc_queue_traits Namespace Reference

Various stuff related to MPMC event queue implementation and tuning. More...

Namespaces

namespace  combined_lock
 Implementation of combined lock for MPMC event queue.
 
namespace  simple_lock
 Implementation of simple lock for MPMC event queue.
 

Classes

class  condition_t
 An interface for somethine like condition variable for waiting on MPMC queue lock. More...
 
class  lock_t
 An interface for lock for MPMC queue. More...
 
class  queue_params_t
 Container for storing parameters for MPMC queue. More...
 

Typedefs

using condition_unique_ptr_t = std::unique_ptr< condition_t >
 Alias of unique_ptr for condition.
 

Functions

std::chrono::high_resolution_clock::duration default_combined_lock_waiting_time ()
 Default timeout used by combined_lock for waiting on spinlock before switching to mutex-based locking scheme.
 
SO_5_FUNC lock_factory_t combined_lock_factory (std::chrono::high_resolution_clock::duration waiting_time)
 Factory for creation of combined queue lock with the specified waiting time.
 
lock_factory_t combined_lock_factory ()
 Factory for creation of combined queue lock with default waiting time.
 
SO_5_FUNC lock_factory_t simple_lock_factory ()
 Factory for creation of very simple implementation based on usage of mutex and condition_variable only.
 

Detailed Description

Various stuff related to MPMC event queue implementation and tuning.

Since
v.5.5.11

Typedef Documentation

◆ condition_unique_ptr_t

Alias of unique_ptr for condition.

Since
v.5.5.11

Definition at line 76 of file mpmc_queue_traits/pub.hpp.

Function Documentation

◆ combined_lock_factory() [1/2]

lock_factory_t so_5::disp::mpmc_queue_traits::combined_lock_factory ( )
inline

Factory for creation of combined queue lock with default waiting time.

Usage example:
using namespace so_5::disp::thread_pool;
auto disp = make_dispatcher(
env,
"db_workers_pool",
.thread_count( 16 )
.tune_queue_params( []( queue_traits::queue_params_t & params ) {
} ) );
Container for storing parameters for MPSC queue.
queue_params_t & lock_factory(lock_factory_t factory)
Setter for lock factory.
Alias for namespace with traits of event queue.
disp_params_t & thread_count(std::size_t count)
Setter for thread count.
lock_factory_t combined_lock_factory()
Factory for creation of combined queue lock with default waiting time.
Thread pool dispatcher.
Since
v.5.5.11

Definition at line 195 of file mpmc_queue_traits/pub.hpp.

◆ combined_lock_factory() [2/2]

SO_5_FUNC lock_factory_t so_5::disp::mpmc_queue_traits::combined_lock_factory ( std::chrono::high_resolution_clock::duration waiting_time)

Factory for creation of combined queue lock with the specified waiting time.

Usage example:
using namespace so_5::disp::thread_pool;
auto disp = make_dispatcher(
env,
"db_workers_pool",
.thread_count( 16 )
.tune_queue_params( []( queue_traits::queue_params_t & params ) {
// Switch to mutex after 125us of busy waiting.
std::chrono::microseconds{125} ) );
} ) );
Since
v.5.5.11
Parameters
waiting_timeMax waiting time for waiting on spinlock before switching to mutex.

Definition at line 274 of file mpmc_queue_traits/pub.cpp.

◆ default_combined_lock_waiting_time()

std::chrono::high_resolution_clock::duration so_5::disp::mpmc_queue_traits::default_combined_lock_waiting_time ( )
inline

Default timeout used by combined_lock for waiting on spinlock before switching to mutex-based locking scheme.

Since
v.5.5.11

Definition at line 140 of file mpmc_queue_traits/pub.hpp.

◆ simple_lock_factory()

SO_5_FUNC lock_factory_t so_5::disp::mpmc_queue_traits::simple_lock_factory ( )

Factory for creation of very simple implementation based on usage of mutex and condition_variable only.

Usage example:
using namespace so_5::disp::thread_pool;
auto disp = make_dispatcher(
env,
"db_workers_pool",
.thread_count( 16 )
.tune_queue_params( []( queue_traits::queue_params_t & params ) {
} ) );
SO_5_FUNC lock_factory_t simple_lock_factory()
Factory for creation of very simple implementation based on usage of mutex and condition_variable onl...
Since
v.5.5.11

Definition at line 287 of file mpmc_queue_traits/pub.cpp.