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)
README.md b04ce36a75a1cc03f592f498320bcbd2487391e3 Ubuntu 2020-01-21 05:17:29
stack example 10c89c204a6c7173da4cab531b023e49b43b282f Ubuntu 2020-01-21 05:10:05
rename namespace 58de02fbcccc180ddbd895c03fe7615d85079fc2 mucbuc 2020-01-19 12:06:11
cleanup 5ffc59ee2057db41384465ada3ce02da94928d83 mucbuc 2020-01-19 11:48:09
fixed swap e79678e9a0f6c401bf6c75c073b4afb1d9c99239 mucbuc 2020-01-16 12:33:51
add unlock ed0dd962bd7e1468faa3f74a6d61c6ba94b8db13 mucbuc 2020-01-12 16:43:19
documentaoion 731b8bf31861113f070ee9e3613fdfbaef1e70a6 mucbuc 2020-01-12 15:46:29
index.h 74aafab338206a3d3c02b7448852dbde831692dc mucbuc 2020-01-12 04:42:02
factory returns shared_ptr 0d8ff1b381e3c7e275ebd99705853f54b100cdf9 mucbuc 2020-01-12 04:05:15
init 01daaea5899ac77acb8ec0c15583573d78eb9f31 mucbuc 2020-01-12 03:10:36
Commit b04ce36a75a1cc03f592f498320bcbd2487391e3 - README.md
Author: Ubuntu
Author date (UTC): 2020-01-21 05:17
Committer name: Ubuntu
Committer date (UTC): 2020-01-21 05:17
Parent(s): 10c89c204a6c7173da4cab531b023e49b43b282f
Signer:
Signing key:
Signing status: N
Tree: 3f2b06c7da2b367737dec25853d0ca8f5c0de74c
File Lines added Lines deleted
README.md 47 3
File README.md changed (mode: 100644) (index e8eeb01..300d35a)
... ... Syncronize container operations (for single objects)
5 5 ## Interface ## Interface
6 6
7 7 ``` ```
8 circuit.check_pop(variable)
9 circuit.wait_pop(variable)
10 circuit.push(1);
8 namespace om636 {
9 namespace circuit {
10
11 template <class T>
12 struct Circuit {
13 typedef T value_type;
14
15 virtual ~Circuit() = default;
16 virtual void push(value_type&&) = 0;
17 virtual bool check_pop(value_type&) = 0;
18 virtual void wait_pop(value_type&) = 0;
19 };
20
21 } // circuit
22 } // om636
11 23 ``` ```
24
25 ## Example
26 ```
27 using namespace std;
28 using namespace om636::circuit;
29
30 int main()
31 {
32 CircuitStack<int> s;
33 auto t = thread([&]() {
34 int i(0);
35 s.wait_pop(i);
36 cout << "popped: " << i << endl;
37 s.push(88);
38 s.push(77);
39 });
40
41 s.push(99);
42 t.join();
43
44 int i(0);
45 while (s.check_pop(i)) {
46 cout << "popped: " << i << endl;
47 }
48 }
49 ```
50
51 #####output
52 popped: 99
53 popped: 77
54 popped: 88
55
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