Skip to content

Commit 6304593

Browse files
author
Kjell Hedström
authored
Merge pull request #5 from KjellKod/COPY
Copy
2 parents 2b2a67c + 1fa60c7 commit 6304593

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/q/mpmc_flexible_lock_queue.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ namespace mpmc {
5454

5555
// -1 : unbounded
5656
// 0 ... N : bounded (0 is silly)
57-
flexible_lock_queue(int maxSize = kSmallDefault);
57+
flexible_lock_queue(const int maxSize = kSmallDefault);
5858

5959
bool lock_free() const;
6060
bool push(T& item);

test/test_queue.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,28 @@ void ProdConsInitialization(Prod& prod, Cons& cons ) {
4747
}
4848

4949

50+
51+
5052
TEST(Queue, ProdConsInitialization) {
5153
auto queue = queue_api::CreateQueue<FlexibleQ>(10);
5254
auto producer = std::get<queue_api::index::sender>(queue);
5355
auto consumer = std::get<queue_api::index::receiver>(queue);
5456
}
5557

5658

59+
60+
TEST(Queue, ProdConsInitializationCopy) {
61+
using namespace queue_api;
62+
using QueuePair = std::pair<Sender<FlexibleQ>, Receiver<FlexibleQ>>;
63+
QueuePair queue = CreateQueue<FlexibleQ>(10);
64+
Sender<FlexibleQ> sender1 = std::get<index::sender>(queue);
65+
Sender<FlexibleQ> sender2(std::get<index::sender>(queue));
66+
Receiver<FlexibleQ> receiver1 = std::get<index::receiver>(queue);
67+
Receiver<FlexibleQ> receiver2(std::get<index::receiver>(queue));
68+
}
69+
70+
71+
5772
struct HasWaitAndPop{
5873
std::chrono::milliseconds value;
5974
std::string element;

0 commit comments

Comments
 (0)