ipcq 0.12.0
Loading...
Searching...
No Matches
shm.hpp File Reference

Contains core shm implementation details. More...

#include <atomic>
#include <array>
#include <chrono>
#include <functional>
#include <signal.h>
#include <system_error>
#include <thread>
#include <type_traits>
#include <boost/version.hpp>
#include <boost/date_time/microsec_time_clock.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/interprocess/mapped_region.hpp>
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/sync/interprocess_condition.hpp>
#include <boost/interprocess/sync/interprocess_mutex.hpp>
#include <boost/interprocess/sync/scoped_lock.hpp>
#include <numapp/mempolicy.hpp>
#include "../error.hpp"
#include "iterator.hpp"
#include "traits.hpp"

Go to the source code of this file.

Classes

struct  ipcq::detail::QueueInfo
 Static parameters for a given shm queue. More...
 
struct  ipcq::detail::ShmControlBlock
 Control block residing in shared memory shared by readers and writers. More...
 
class  ipcq::detail::ShmRemover< ShmTraits >
 Small helper that removes shared memory, to make ShmControl exception-safe with RAII. More...
 
class  ipcq::detail::SpinConditionPolicy
 Simple spinning condition. More...
 
class  ipcq::detail::BoostConditionPolicy
 Condition policy based on boost::interprocess::interprocess_condition. More...
 
struct  ipcq::detail::BoostInterprocessTraits
 
class  ipcq::detail::ShmControlBase< ShmTraits >
 Non-virtual base-class for ShmControl that does not depend on any static type. More...
 
class  ipcq::detail::ShmControl< T, ConditionPolicy, ShmTraits >
 ShmControl provides the basic data model for the queue and low level operations on the shared memory queue, some of which are atomic. More...
 
struct  ipcq::detail::ShmControl< T, ConditionPolicy, ShmTraits >::Element
 
struct  ipcq::detail::ShmControl< T, ConditionPolicy, ShmTraits >::Queue
 

Namespaces

namespace  ipcq
 
namespace  ipcq::detail
 
namespace  ipcq::detail::config
 

Macros

#define restrict
 
#define IPCQ_ENABLE_ASSERT
 
#define IPCQ_ENABLE_LOG
 
#define IPCQ_ASSERT(x)
 
#define IPCQ_LOG(x)
 
#define IPCQ_FILE_VERSION   1
 Version number.
 

Functions

void ipcq::detail::PrefaultPages (void const *begin, void const *end) noexcept
 Prefault memory by reading a byte in every page starting at start up to lenght bytes.
 
template<class Rep, class Period>
boost::posix_time::ptime ipcq::detail::AddDuration (boost::posix_time::ptime const &point, std::chrono::duration< Rep, Period > duration) noexcept
 Helper that adds to posix_time::ptime a std:chrono duration.
 
std::string ipcq::detail::MakeShmObjectName (char const *topic_name)
 Creates the shared memory object name from topic_name.
 

Variables

constexpr std::array< uint8_t, 7 > ipcq::detail::config::MAGIC_NUMBER = {0x69, 0x70, 0x63, 0x71, 0xF0, 0x6A, 0x9C}
 File magic number that identifies ipcq shared objects.
 
constexpr std::string_view ipcq::detail::config::SHM_OBJECT_NAME_PREFIX = "ipcq-"
 Prefix used for shared object names.
 
constexpr auto ipcq::detail::config::BIT_COUNT = 21u
 Number of bits making up first, last and size each for a total of 63 bits.
 
constexpr auto ipcq::detail::config::BIT_MASK = 0x1f'ffffu
 Bitmask for bit count.
 
constexpr auto ipcq::detail::config::MAX_VALUE = 2097151u
 Maximum number of elements in queue.
 
constexpr auto ipcq::detail::config::BIT_IS_CLOSED = 0x8000'0000'0000'0000u
 Bit indicating if queue is closed (highest bit).
 
constexpr size_t ipcq::detail::config::TYPENAME_SEQ_LEN = 128
 Length of typename character sequences.
 

Detailed Description

Contains core shm implementation details.

SPDX-License-Identifier: LGPL-3.0-only

Definition in file shm.hpp.

Macro Definition Documentation

◆ IPCQ_ASSERT

#define IPCQ_ASSERT ( x)
Value:
do { \
assert(x); \
} while (0)

Definition at line 49 of file shm.hpp.

◆ IPCQ_ENABLE_ASSERT

#define IPCQ_ENABLE_ASSERT

Definition at line 44 of file shm.hpp.

◆ IPCQ_ENABLE_LOG

#define IPCQ_ENABLE_LOG

Definition at line 45 of file shm.hpp.

◆ IPCQ_FILE_VERSION

#define IPCQ_FILE_VERSION   1

Version number.

Definition at line 67 of file shm.hpp.

◆ IPCQ_LOG

#define IPCQ_LOG ( x)
Value:
do { \
std::cout << x << std::endl; \
} while (0)

Definition at line 58 of file shm.hpp.

◆ restrict

#define restrict

Definition at line 40 of file shm.hpp.