Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Main Page
Namespaces
Classes
Files
File List
File Members
concurrent_queue.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015 Roc 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_packet/concurrent_queue.h
10
//! @brief Concurrent blocking packet queue.
11
12
#ifndef ROC_PACKET_CONCURRENT_QUEUE_H_
13
#define ROC_PACKET_CONCURRENT_QUEUE_H_
14
15
#include "
roc_core/cond.h
"
16
#include "
roc_core/list.h
"
17
#include "
roc_core/mutex.h
"
18
#include "
roc_core/noncopyable.h
"
19
#include "
roc_packet/ireader.h
"
20
#include "
roc_packet/iwriter.h
"
21
#include "
roc_packet/packet.h
"
22
23
namespace
roc
{
24
namespace
packet {
25
26
//! Concurrent blocking packet queue.
27
class
ConcurrentQueue
:
public
IReader
,
public
IWriter
,
public
core::NonCopyable
<> {
28
public
:
29
ConcurrentQueue
();
30
31
//! Read next packet.
32
//! @remarks
33
//! Blocks until the queue becomes non-empty and returns the first
34
//! packet from the queue.
35
virtual
PacketPtr
read
();
36
37
//! Add packet to the queue.
38
//! @remarks
39
//! Adds packet to the end of the queue.
40
virtual
void
write
(
const
PacketPtr
& packet);
41
42
private
:
43
core::Mutex
mutex_;
44
core::Cond
cond_;
45
core::List<Packet>
list_;
46
};
47
48
}
// namespace packet
49
}
// namespace roc
50
51
#endif // ROC_PACKET_CONCURRENT_QUEUE_H_
roc::packet::ConcurrentQueue::read
virtual PacketPtr read()
Read next packet.
ireader.h
Packet reader interface.
roc::packet::IReader
Packet reader interface.
Definition:
ireader.h:21
roc::core::Cond
Condition variable.
Definition:
cond.h:25
roc
Root namespace.
roc::core::List
Intrusive doubly-linked list.
Definition:
list.h:31
roc::core::Mutex
Mutex.
Definition:
mutex.h:27
iwriter.h
Packet writer interface.
roc::packet::IWriter
Packet writer interface.
Definition:
iwriter.h:21
list.h
Intrusive doubly-linked list.
roc::core::SharedPtr< Packet >
roc::core::NonCopyable
Base class for non-copyable objects.
Definition:
noncopyable.h:23
mutex.h
Mutex.
roc::packet::ConcurrentQueue::write
virtual void write(const PacketPtr &packet)
Add packet to the queue.
roc::packet::ConcurrentQueue
Concurrent blocking packet queue.
Definition:
concurrent_queue.h:27
packet.h
Packet.
cond.h
Condition variable.
noncopyable.h
Non-copyable object.
roc_packet
concurrent_queue.h
Generated by
1.8.11