Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
mpsc_queue_impl.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2020 Roc Streaming authors
3
*
4
* This Source Code Form is subject to the terms of the Mozilla Public
5
* License, v. 2.0. If a copy of the MPL was not distributed with this
6
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
*/
8
9
//! @file roc_core/mpsc_queue_impl.h
10
//! @brief Multi-producer single-consumer queue internal implementation.
11
12
#ifndef ROC_CORE_MPSC_QUEUE_IMPL_H_
13
#define ROC_CORE_MPSC_QUEUE_IMPL_H_
14
15
#include "
roc_core/mpsc_queue_node.h
"
16
17
namespace
roc
{
18
namespace
core {
19
20
//! Multi-producer single-consumer queue internal implementation class.
21
//!
22
//! Provides only push/pop functionality. Ownership is left up to the main MpscQueue
23
//! class.
24
class
MpscQueueImpl
{
25
public
:
26
MpscQueueImpl
();
27
28
~
MpscQueueImpl
();
29
30
//! Add object to the end of the queue.
31
void
push_back
(
MpscQueueNode::MpscQueueData
* node);
32
33
//! Remove object from the beginning of the queue.
34
MpscQueueNode::MpscQueueData
*
pop_front
(
bool
can_spin);
35
36
private
:
37
typedef
MpscQueueNode::MpscQueueData
MpscQueueData
;
38
39
void
push_node_(
MpscQueueData
* node);
40
MpscQueueData
* pop_node_(
bool
can_spin);
41
42
MpscQueueData
* wait_next_(
MpscQueueData
* node);
43
MpscQueueData
* try_wait_next_(
MpscQueueData
* node);
44
45
void
change_owner_(
MpscQueueData
* node,
void
* from,
void
* to);
46
47
MpscQueueData
* tail_;
48
MpscQueueData
* head_;
49
50
MpscQueueData
stub_;
51
};
52
53
}
// namespace core
54
}
// namespace roc
55
56
#endif
// ROC_CORE_MPSC_QUEUE_IMPL_H_
roc::core::MpscQueueImpl
Multi-producer single-consumer queue internal implementation class.
Definition:
mpsc_queue_impl.h:24
roc::core::MpscQueueImpl::push_back
void push_back(MpscQueueNode::MpscQueueData *node)
Add object to the end of the queue.
roc::core::MpscQueueImpl::pop_front
MpscQueueNode::MpscQueueData * pop_front(bool can_spin)
Remove object from the beginning of the queue.
mpsc_queue_node.h
MpscQueue node.
roc
Root namespace.
roc::core::MpscQueueNode::MpscQueueData
List node data.
Definition:
mpsc_queue_node.h:27
roc_core
mpsc_queue_impl.h
Generated by
1.9.1