<commit_before>
#ifndef _JIMI_DISRUPTOR_RINGQUEUEEX_H_
#define _JIMI_DISRUPTOR_RINGQUEUEEX_H_

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

#include "vs_stdint.h"
#include "port.h"
#include "sleep.h"

//#include <atomic>

#ifndef _MSC_VER
#include <pthread.h>
#include "msvc/pthread.h"
#else
#include "msvc/pthread.h"
#endif  // !_MSC_VER

#ifdef _MSC_VER
#include <intrin.h>     // For _ReadWriteBarrier(), InterlockedCompareExchange()
#endif  // _MSC_VER
#include <emmintrin.h>

#include "Sequence.h"

#include <stdio.h>
#include <string.h>
#include <assert.h>

#include "dump_mem.h"

#define JIMI_ALIGNED_TO(n, alignment)   \
    (((n) + ((alignment) - 1)) & ~(size_t)((alignment) - 1))

// 打开 Entries 高级存储方式
#define ENTRIES_ADVANCED_SAVE_MODE      1

namespace jimi {

template <typename ItemType, size_t EntryCellSize, bool isAligned>
struct gEntryCell_t
{
    ItemType  entry;
};

template <>
struct gEntryCell_t<ItemType, EntryCellSize, false>
{
    ItemType entry;
    char     padding[EntryCellSize - sizeof(ItemType)];
};

///////////////////////////////////////////////////////////////////
// class DisruptorRingQueueEx<T, SequenceType, Capacity, Producers, Consumers, NumThreads>
///////////////////////////////////////////////////////////////////

template <typename T, typename SequenceType = int64_t, uint32_t Capacity = 1024U,
          uint32_t Producers = 0, uint32_t Consumers = 0, uint32_t NumThreads = 0>
class DisruptorRingQueueEx
{
public:
    typedef T                           item_type;
    typedef item_type                   value_type;
#if 0
    typedef size_t                      size_type;    <commit_msg>Fixed a problem on GCC;<commit_after>
#ifndef _JIMI_DISRUPTOR_RINGQUEUEEX_H_
#define _JIMI_DISRUPTOR_RINGQUEUEEX_H_

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

#include "vs_stdint.h"
#include "port.h"
#include "sleep.h"

//#include <atomic>

#ifndef _MSC_VER
#include <pthread.h>
#include "msvc/pthread.h"
#else
#include "msvc/pthread.h"
#endif  // !_MSC_VER

#ifdef _MSC_VER
#include <intrin.h>     // For _ReadWriteBarrier(), InterlockedCompareExchange()
#endif  // _MSC_VER
#include <emmintrin.h>

#include "Sequence.h"

#include <stdio.h>
#include <string.h>
#include <assert.h>

#include "dump_mem.h"

#define JIMI_ALIGNED_TO(n, alignment)   \
    (((n) + ((alignment) - 1)) & ~(size_t)((alignment) - 1))

// 打开 Entries 高级存储方式
#define ENTRIES_ADVANCED_SAVE_MODE      1

namespace jimi {

template <typename ItemType, size_t EntryCellSize, bool isAligned>
struct gEntryCell_t
{
    ItemType  entry;
};

template <typename ItemType, size_t EntryCellSize>
struct gEntryCell_t<ItemType, EntryCellSize, false>
{
    ItemType entry;
    char     padding[EntryCellSize - sizeof(ItemType)];
};

///////////////////////////////////////////////////////////////////
// class DisruptorRingQueueEx<T, SequenceType, Capacity, Producers, Consumers, NumThreads>
///////////////////////////////////////////////////////////////////

template <typename T, typename SequenceType = int64_t, uint32_t Capacity = 1024U,
          uint32_t Producers = 0, uint32_t Consumers = 0, uint32_t NumThreads = 0>
class DisruptorRingQueueEx
{
public:
    typedef T                           item_type;
    typedef item_type                   value_type;
#if 0
    typedef size_t                      size_type;    
{'fraction_non_alphanumeric': 0.18306092124814263, 'fraction_numerical': 0.014858841010401188, 'mean_word_length': 2.634989200863931, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3299546', 'n_tokens_mistral': 1239, 'n_tokens_neox': 1153, 'n_words': 264}