List of commits:
Subject Hash Author Date (UTC)
update libs 177bc958e60841f894a4c9c4d5758db38e07a5c3 mucbuc 2020-02-12 13:22:59
once tests 9aae5bf8c8a46439e7b350c4166c1be22c6028bf mucbuc 2020-01-20 20:08:50
once a72a9ea4d78e082b0e4e6a8545af92e116bd7536 mucbuc 2020-01-20 17:32:34
dynamo 25b14b6965bb24b21516dde3f4a2a1922d518ae5 mucbuc 2020-01-20 17:27:35
concurrent test passes 2bd62976d536c8c81659453e899a2e9c588f4aa6 mucbuc 2020-01-20 12:54:46
update dynamo 3315ba6e643d56478aaf05761368d76e9025de79 mucbuc 2020-01-20 12:13:05
circular update 7545023e77dcb92f28612a62b6405cb488adddc8 mucbuc 2020-01-19 12:09:22
cleanup remove stuff abe9e96601cdfc558823e6d856d16dac8ad15929 mucbuc 2020-01-19 11:52:54
circut update 4d75370846cd93032a684b5193494273a9ba9da9 mucbuc 2020-01-19 11:50:21
dynamoe update 814d85ebb0c03dddfd2d804d404286cc01209687 mucbuc 2020-01-19 06:59:11
simplify interfiace f69d4f7a7c2c02125ac51ffb9d4ba41ed08f8646 mucbuc 2020-01-19 06:41:36
fix another test fd8e7fa14a4daa281e7fbcec875bfe56ce39e400 mucbuc 2020-01-18 22:42:40
working on tests 1b57cbb4e806eda21565dc8bd7e7fe7ff1cb5fff mucbuc 2020-01-18 22:36:15
fix test 8b364e739d1e12cd77b9f63efb0a245a75e695df mucbuc 2020-01-18 21:49:21
fix emit once 71aba1ef472aa23c9c9a8529b5258599a6289c16 mucbuc 2020-01-18 21:41:03
remove agentlifetime test ce0fba661c6110fc050203a1a8f9fedf39258615 mucbuc 2020-01-18 11:25:44
emit with arg passes 1b2288e8472b749c513120c441397a77298ab0b7 mucbuc 2020-01-17 10:58:28
dynamo update 7082792be9aa3ccb56b0afbddf58bdf468d56030 mucbuc 2020-01-17 05:32:03
circuit 9877e777b93a54d396248ad449f6ba5abf324733 mucbuc 2020-01-17 04:22:05
dynamo v2dev 15f474b5a627558c230b2fe96c40fb5c68a176d0 mucbuc 2020-01-17 04:21:40
Commit 177bc958e60841f894a4c9c4d5758db38e07a5c3 - update libs
Author: mucbuc
Author date (UTC): 2020-02-12 13:22
Committer name: mucbuc
Committer date (UTC): 2020-02-12 13:22
Parent(s): 4cf598c74241882483fefc77e724099cd6092570
Signing key:
Tree: 452ab40bc19bc0233f96dde4c91bf18fa9f5b8cb
File Lines added Lines deleted
test/lib/circuit/.gitignore 2 1
test/lib/circuit/EXAMPLE.md 29 0
test/lib/circuit/README.md 46 5
test/lib/circuit/package.json 3 2
test/lib/circuit/src/impl/circuit_host.h 2 0
test/lib/circuit/src/impl/circuit_host.hxx 23 2
test/lib/circuit/src/impl/queue.h 8 0
test/lib/circuit/src/impl/stack.h 8 0
test/lib/circuit/src/index.h 5 6
test/lib/circuit/src/interface.h 1 1
test/lib/circuit/test/example.json 1 1
test/lib/circuit/test/src/example.cpp 18 0
test/lib/circuit/test/src/main.cpp 0 1
test/lib/dynamo/README.md 19 5
File test/lib/circuit/.gitignore changed (mode: 100644) (index 6f7455b..9b920a4)
1 1 .DS_Store .DS_Store
2 node_modules/
2 3 test/tmp test/tmp
3 test/lib
4 test/lib
File test/lib/circuit/EXAMPLE.md added (mode: 100644) (index 0000000..0505168)
1 const fs = require('fs'),
2 path = require('path'),
3 tbt = "```";
4
5 template = `
6 ## Example
7 ${tbt}
8 #include <tmp/src/test.h>
9
10 #include <lib/circuit/src/index.h>
11
12 using namespace std;
13 using namespace om636::circuit;
14
15 int main()
16 {
17 CircuitStack<int> s;
18
19 s.push(88);
20 s.push(77);
21
22 int i;
23 s.wait_pop(i);
24 if (s.check_pop(i)) {
25
26 }
27 }
28 ${tbt}
29 `;
File test/lib/circuit/README.md changed (mode: 100644) (index e8eeb01..7b85e05)
1 ## Objective
1 # circuit
2 2
3 Syncronize container operations (for single objects)
3 Syncronize container operations for single objects
4 4
5 5 ## Interface ## Interface
6 ```
7 #pragma once
8
9 namespace om636 {
10 namespace circuit {
11
12 template <class T>
13 struct Circuit {
14 typedef T value_type;
15
16 virtual ~Circuit() = default;
17 virtual void push(value_type&&) = 0;
18 virtual bool check_pop(value_type&) = 0;
19 virtual void wait_pop(value_type&) = 0;
20 virtual Circuit* clone() const = 0;
21 };
22
23 } // circuit
24 } // om636
6 25
7 26 ``` ```
8 circuit.check_pop(variable)
9 circuit.wait_pop(variable)
10 circuit.push(1);
27
28
29 ## Example
11 30 ``` ```
31 #include <tmp/src/test.h>
32
33 #include <lib/circuit/src/index.h>
34
35 using namespace std;
36 using namespace om636::circuit;
37
38 int main()
39 {
40 CircuitStack<int> s;
41
42 s.push(88);
43 s.push(77);
44
45 int i;
46 s.wait_pop(i);
47 if (s.check_pop(i)) {
48
49 }
50 }
51 ```
52
File test/lib/circuit/package.json changed (mode: 100644) (index 46fc3d5..5a7c3ec)
1 1 { {
2 2 "name": "circuit", "name": "circuit",
3 3 "version": "1.0.0", "version": "1.0.0",
4 "description": "",
4 "description": "Syncronize container operations for single objects",
5 5 "main": "index.js", "main": "index.js",
6 6 "directories": { "directories": {
7 7 "test": "test" "test": "test"
8 8 }, },
9 9 "scripts": { "scripts": {
10 10 "test": "crimp -g test/test.json", "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 "format": "clang-format -i --style=Webkit src/*.h src/impl/*.h src/impl/*.hxx test/src/*.cpp",
12 "generateDoc": "doc-tool package_header src_interface ./EXAMPLE.md > README.md"
12 13 }, },
13 14 "author": "", "author": "",
14 15 "license": "ISC" "license": "ISC"
File test/lib/circuit/src/impl/circuit_host.h changed (mode: 100644) (index be202e3..375f033)
... ... namespace circuit {
17 17 using typename base_type::value_type; using typename base_type::value_type;
18 18
19 19 CircuitHost() = default; CircuitHost() = default;
20 CircuitHost(const CircuitHost&);
20 21 CircuitHost(CircuitHost&&); CircuitHost(CircuitHost&&);
21 22 CircuitHost& operator=(CircuitHost); CircuitHost& operator=(CircuitHost);
22 23
 
... ... namespace circuit {
28 29 void push(value_type&&) override; void push(value_type&&) override;
29 30 bool check_pop(value_type&) override; bool check_pop(value_type&) override;
30 31 void wait_pop(value_type&) override; void wait_pop(value_type&) override;
32 CircuitHost* clone() const override;
31 33
32 34 private: private:
33 35 typedef U<T> policy_type; typedef U<T> policy_type;
File test/lib/circuit/src/impl/circuit_host.hxx changed (mode: 100644) (index 178dfb8..fdf9742)
1 1 namespace om636 { namespace om636 {
2 2 namespace circuit { namespace circuit {
3 3
4 /////////////////////////////////////////////////////////////////////////////////////////////
5 template <typename T, template <typename> class U>
6 CircuitHost<T, U>::CircuitHost(const CircuitHost& rhs)
7 {
8 typedef std::unique_lock<mutex_type> lock_type;
9
10 lock_type left_lock(m_mutex, std::defer_lock);
11 lock_type right_lock(rhs.m_mutex, std::defer_lock);
12 std::lock(left_lock, right_lock);
13
14 policy_type::on_copy(*this, rhs);
15 }
16
4 17 ///////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////
5 18 template <typename T, template <typename> class U> template <typename T, template <typename> class U>
6 19 CircuitHost<T, U>::CircuitHost(CircuitHost&& rhs) CircuitHost<T, U>::CircuitHost(CircuitHost&& rhs)
 
... ... namespace circuit {
48 61 bool result(false); bool result(false);
49 62 std::thread([this, &result]() { std::thread([this, &result]() {
50 63 result = m_mutex.try_lock(); result = m_mutex.try_lock();
51 if (result) {
52 m_mutex.unlock();
64 if (result) {
65 m_mutex.unlock();
53 66 } }
54 67 }).join(); }).join();
55 68 return !result; return !result;
 
... ... namespace circuit {
86 99 m_condition.wait(lock, [this] { return !policy_type::on_empty(*this); }); m_condition.wait(lock, [this] { return !policy_type::on_empty(*this); });
87 100 policy_type::on_pop(*this, value); policy_type::on_pop(*this, value);
88 101 } }
102
103 /////////////////////////////////////////////////////////////////////////////////////////////
104 template <typename T, template <typename> class U>
105 auto CircuitHost<T, U>::clone() const -> CircuitHost*
106 {
107 return new CircuitHost(*this);
108 }
109
89 110 } // circuit } // circuit
90 111 } // om636 } // om636
File test/lib/circuit/src/impl/queue.h changed (mode: 100644) (index bc763a3..b4aaa20)
... ... namespace circuit {
17 17 lhs.m_queue = std::move(rhs.m_queue); lhs.m_queue = std::move(rhs.m_queue);
18 18 } }
19 19
20 template <class U>
21 static void on_copy(U& lhs, const U& rhs)
22 {
23 ASSERT(lhs.is_locked());
24 ASSERT(rhs.is_locked());
25 lhs.m_queue = rhs.m_queue;
26 }
27
20 28 template <class U> template <class U>
21 29 static void on_swap(U& lhs, U& rhs) static void on_swap(U& lhs, U& rhs)
22 30 { {
File test/lib/circuit/src/impl/stack.h changed (mode: 100644) (index bdbf6ac..4f0cdea)
... ... namespace circuit {
9 9 struct StackPolicy { struct StackPolicy {
10 10 typedef T value_type; typedef T value_type;
11 11
12 template <class U>
13 static void on_copy(U& lhs, const U& rhs)
14 {
15 ASSERT(lhs.is_locked());
16 ASSERT(rhs.is_locked());
17 lhs.m_stack = rhs.m_stack;
18 }
19
12 20 template <class U> template <class U>
13 21 static void on_init(U& lhs, U&& rhs) static void on_init(U& lhs, U&& rhs)
14 22 { {
File test/lib/circuit/src/index.h changed (mode: 100644) (index 1742512..aac2bba)
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 circuit { namespace circuit {
9 9
10 template<typename T>
11 using CircuitStack = CircuitHost<T, StackPolicy>;
10 template <typename T>
11 using CircuitStack = CircuitHost<T, StackPolicy>;
12 12
13 template<typename T>
14 using CircuitQueue = CircuitHost<T, QueuePolicy>;
13 template <typename T>
14 using CircuitQueue = CircuitHost<T, QueuePolicy>;
15 15
16 16 } // circuit } // circuit
17 17 } // om636 } // om636
18
File test/lib/circuit/src/interface.h changed (mode: 100644) (index 32d8ab4..8b562d1)
... ... namespace circuit {
11 11 virtual void push(value_type&&) = 0; virtual void push(value_type&&) = 0;
12 12 virtual bool check_pop(value_type&) = 0; virtual bool check_pop(value_type&) = 0;
13 13 virtual void wait_pop(value_type&) = 0; virtual void wait_pop(value_type&) = 0;
14 virtual Circuit* clone() const = 0;
14 15 }; };
15 16
16 17 } // circuit } // circuit
17 18 } // om636 } // om636
18
File test/lib/circuit/test/example.json copied from file test/lib/circuit/test/test.json (similarity 76%) (mode: 100644) (index 278ac7a..810ed56)
3 3 "lib/circuit/circuit.json" "lib/circuit/circuit.json"
4 4 ], ],
5 5 "sources": [ "sources": [
6 "src/main.cpp"
6 "src/example.cpp"
7 7 ] ]
8 8 } }
File test/lib/circuit/test/src/example.cpp added (mode: 100644) (index 0000000..52afea0)
1 #include <tmp/src/test.h>
2
3 #include <lib/circuit/src/index.h>
4
5 using namespace std;
6 using namespace om636::circuit;
7
8 int main()
9 {
10 CircuitStack<int> s;
11
12 s.push(88);
13 s.push(77);
14
15 s.wait_pop(i);
16 if (s.check_pop(i)) {
17 }
18 }
File test/lib/circuit/test/src/main.cpp changed (mode: 100644) (index dd6faf3..df6a636)
... ... int main()
25 25 test_wait_pop(std::make_shared<CircuitStack<int>>()); test_wait_pop(std::make_shared<CircuitStack<int>>());
26 26 test_wait_pop(std::make_shared<CircuitQueue<int>>()); test_wait_pop(std::make_shared<CircuitQueue<int>>());
27 27
28
29 28 CircuitQueue<int> a, b; CircuitQueue<int> a, b;
30 29 a.swap(b); a.swap(b);
31 30
File test/lib/dynamo/README.md changed (mode: 100644) (index 9b9214b..64a5f8e)
... ... Dispatch work to agents.
6 6
7 7 ### Interface: ### Interface:
8 8 ``` ```
9 batch.hook( function ) -> agent
10 batch.invoke( ... )
11 batch.kill( ... )
12 batch.kill_invoke( ... )
13 batch.is_dead()
9 namespace om636 {
10 namespace control {
11
12 template <typename... T>
13 class Batch {
14 public:
15 typedef std::function<void(T...)> function_type;
16 typedef std::shared_ptr<function_type> agent_type;
17 typedef agent_type listener_type;
18
19 virtual ~Batch() = default;
20 virtual agent_type hook(function_type) = 0;
21 virtual agent_type hook_once(function_type) = 0;
22 virtual void invoke(T...) = 0;
23 };
24
25 } // control
26 } // om636
14 27 ``` ```
28
15 29 ### Dependencies ### Dependencies
16 30
17 31 Dynamo uses Circuit for thread syncronization Dynamo uses Circuit for thread syncronization
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/ohm

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

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

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