aboutsummaryrefslogtreecommitdiffstats
path: root/tests/syncqueue/test.cpp
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2018-05-18 19:57:29 +0100
committerYann Herklotz <ymherklotz@gmail.com>2018-05-18 20:06:42 +0100
commitcb23db34b8f7ce8fec4733cf40176305ad124dc4 (patch)
treea41cc105aa7da17f43f23343e7ef8f06faf1676b /tests/syncqueue/test.cpp
parent19817238cdca4bc8471fdfaa61149f098fc6fc1f (diff)
downloadYAGE-cb23db34b8f7ce8fec4733cf40176305ad124dc4.tar.gz
YAGE-cb23db34b8f7ce8fec4733cf40176305ad124dc4.zip
Renaming tests and improving travis file
Diffstat (limited to 'tests/syncqueue/test.cpp')
-rw-r--r--tests/syncqueue/test.cpp53
1 files changed, 0 insertions, 53 deletions
diff --git a/tests/syncqueue/test.cpp b/tests/syncqueue/test.cpp
deleted file mode 100644
index f5c7d7c3..00000000
--- a/tests/syncqueue/test.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/** ---------------------------------------------------------------------------
- * @file: test.cpp
- *
- * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com>
- * MIT License, see LICENSE file for more details.
- * ----------------------------------------------------------------------------
- */
-
-#include <yage.h>
-
-#include <atomic>
-#include <thread>
-
-using namespace yage;
-
-SyncQueue<int> queue;
-std::atomic_int j(0);
-
-void push_to_queue1(int elements)
-{
- for (int i = 0; i < elements; i++) {
- queue.push(1);
- j.fetch_add(1, std::memory_order_relaxed);
- }
- std::cout << "Done 1\n";
-}
-
-void push_to_queue2(int elements)
-{
- for (int i = 0; i < elements; i++) {
- queue.push(2);
- j.fetch_add(1, std::memory_order_relaxed);
- }
- std::cout << "Done 2\n";
-}
-
-int main()
-{
- std::thread first(push_to_queue1, 100000);
- std::thread second(push_to_queue2, 100000);
-
- std::cout << "created threads, now adding in main\n";
- for (int i = 0; i < 1000000; ++i) {
- queue.push(i);
- j.fetch_add(1, std::memory_order_relaxed);
- }
-
- std::cout << "now joining the threads\n";
- first.join();
- second.join();
- std::cout << "done\n"
- << "iterations: " << j << "\n";
-}