Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ksergey committed Jun 8, 2024
1 parent c1bcb95 commit e6fe447
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
5 changes: 4 additions & 1 deletion code/turboq/BoundedMPSCRawQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <turboq/MappedRegion.h>
#include <turboq/MemorySource.h>
#include <turboq/detail/math.h>
#include <turboq/detail/mmap.h>
#include <turboq/detail/memory.h>
#include <turboq/platform.h>

namespace turboq {
Expand Down Expand Up @@ -48,18 +48,21 @@ struct BoundedMPSCRawQueueDetail {

static_assert(std::atomic_ref<std::size_t>::is_always_lock_free);
};
static_assert(std::is_trivially_copyable_v<MemoryHeader>);

/// Control struct for message
struct MessageHeader {
std::size_t payloadSize;
};
static_assert(std::is_trivially_copyable_v<MessageHeader>);

/// Control struct for commit state
struct StateHeader {
alignas(kAlign) bool commited;

static_assert(std::atomic_ref<bool>::is_always_lock_free);
};
static_assert(std::is_trivially_copyable_v<StateHeader>);

/// Align message buffer size
static constexpr std::size_t alignBufferSize(std::size_t value) noexcept {
Expand Down
4 changes: 3 additions & 1 deletion code/turboq/BoundedSPMCRawQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <turboq/MappedRegion.h>
#include <turboq/MemorySource.h>
#include <turboq/detail/math.h>
#include <turboq/detail/mmap.h>
#include <turboq/detail/memory.h>
#include <turboq/platform.h>

namespace turboq {
Expand All @@ -40,13 +40,15 @@ struct BoundedSPMCRawQueueDetail {

static_assert(std::atomic_ref<std::size_t>::is_always_lock_free);
};
static_assert(std::is_trivially_copyable_v<MemoryHeader>);

/// Control struct for message
struct MessageHeader {
std::size_t size;
std::size_t payloadOffset;
std::size_t payloadSize;
};
static_assert(std::is_trivially_copyable_v<MessageHeader>);

/// Align message buffer size
static constexpr std::size_t alignBufferSize(std::size_t value) noexcept {
Expand Down
4 changes: 3 additions & 1 deletion code/turboq/BoundedSPSCRawQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <turboq/MappedRegion.h>
#include <turboq/MemorySource.h>
#include <turboq/detail/math.h>
#include <turboq/detail/mmap.h>
#include <turboq/detail/memory.h>
#include <turboq/platform.h>

namespace turboq {
Expand All @@ -42,13 +42,15 @@ struct BoundedSPSCRawQueueDetail {

static_assert(std::atomic_ref<std::size_t>::is_always_lock_free);
};
static_assert(std::is_trivially_copyable_v<MemoryHeader>);

/// Control struct for message
struct MessageHeader {
std::size_t size;
std::size_t payloadOffset;
std::size_t payloadSize;
};
static_assert(std::is_trivially_copyable_v<MessageHeader>);

/// Align message buffer size
static constexpr std::size_t alignBufferSize(std::size_t value) noexcept {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Sergey Kovalevich <inndie@gmail.com>
// SPDX-License-Identifier: AGPL-3.0

#include "mmap.h"
#include "memory.h"

#include <sys/mman.h>

Expand Down
File renamed without changes.

0 comments on commit e6fe447

Please sign in to comment.