mucbuc / circuit (public) (License: GPLv3) (since 2020-06-28) (hash sha1)
Synchronize container operations for single objects
List of commits:
Subject Hash Author Date (UTC)
factory returns shared_ptr 0d8ff1b381e3c7e275ebd99705853f54b100cdf9 mucbuc 2020-01-12 04:05:15
init 01daaea5899ac77acb8ec0c15583573d78eb9f31 mucbuc 2020-01-12 03:10:36
Commit 0d8ff1b381e3c7e275ebd99705853f54b100cdf9 - factory returns shared_ptr
Author: mucbuc
Author date (UTC): 2020-01-12 04:05
Committer name: mucbuc
Committer date (UTC): 2020-01-12 04:05
Parent(s): 01daaea5899ac77acb8ec0c15583573d78eb9f31
Signer:
Signing key:
Signing status: N
Tree: 9c628de9c0dee3aa8eef350f36d01d7b8f29c30e
File Lines added Lines deleted
package.json 2 1
src/factory.h 11 12
src/impl/circuit_host.hxx 4 4
test/src/main.cpp 2 2
File package.json changed (mode: 100644) (index 2dffab3..46fc3d5)
7 7 "test": "test" "test": "test"
8 8 }, },
9 9 "scripts": { "scripts": {
10 "test": "crimp -g test/test.json"
10 "test": "crimp -g test/test.json",
11 "format": "clang-format -i --style=Webkit src/*.h src/impl/*.h src/impl/*.hxx test/src/*.cpp"
11 12 }, },
12 13 "author": "", "author": "",
13 14 "license": "ISC" "license": "ISC"
File src/factory.h changed (mode: 100644) (index 027ee94..b5e155e)
1 1 #pragma once #pragma once
2 2
3 3 #include "impl/circuit_host.h" #include "impl/circuit_host.h"
4 #include "impl/stack.h"
5 4 #include "impl/queue.h" #include "impl/queue.h"
5 #include "impl/stack.h"
6 6
7 7 namespace om636 { namespace om636 {
8 8 namespace twice_size { namespace twice_size {
9 9
10 template<typename T>
11 Circuit<T> * make_stack()
12 {
13 return new CircuitHost<T, StackPolicy>();
14 }
10 template <typename T>
11 std::shared_ptr<Circuit<T>> make_stack()
12 {
13 return std::make_shared<CircuitHost<T, StackPolicy>>();
14 }
15 15
16 template<typename T>
17 Circuit<T> * make_queue()
18 {
19 return new CircuitHost<T, QueuePolicy>();
20 }
16 template <typename T>
17 std::shared_ptr<Circuit<T>> make_queue()
18 {
19 return std::make_shared<CircuitHost<T, QueuePolicy>>();
20 }
21 21 } // twice_size } // twice_size
22 22 } // om636 } // om636
23
File src/impl/circuit_host.hxx changed (mode: 100644) (index a7f2410..b07e458)
... ... namespace twice_size {
45 45 template <typename T, template <typename> class U> template <typename T, template <typename> class U>
46 46 bool CircuitHost<T, U>::is_locked() const bool CircuitHost<T, U>::is_locked() const
47 47 { {
48 bool result( false );
49 std::thread([this, & result]() {
50 result = m_mutex.try_lock();
51 }).join();
48 bool result(false);
49 std::thread([this, &result]() {
50 result = m_mutex.try_lock();
51 }).join();
52 52 return !result; return !result;
53 53 } }
54 54
File test/src/main.cpp changed (mode: 100644) (index b082b21..9752dd4)
... ... int main()
23 23 { {
24 24 using namespace om636::twice_size; using namespace om636::twice_size;
25 25
26 test_wait_pop(std::shared_ptr<Circuit<int>>(make_stack<int>()));
27 test_wait_pop(std::shared_ptr<Circuit<int>>(make_queue<int>()));
26 test_wait_pop(make_stack<int>());
27 test_wait_pop(make_queue<int>());
28 28
29 29 return 0; return 0;
30 30 } }
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/mucbuc/circuit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/mucbuc/circuit

Clone this repository using git:
git clone git://git.rocketgit.com/user/mucbuc/circuit

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main