Samchon Framework for CPP  1.0.0
ParallelServerArrayMediator.cpp
1 #include <samchon/protocol/master/ParallelServerArrayMediator.hpp>
2 
3 #include <samchon/protocol/master/ParallelSlaveServerMediator.hpp>
4 
5 #include <array>
6 #include <thread>
7 
8 using namespace std;
9 using namespace samchon::library;
10 using namespace samchon::protocol;
11 using namespace samchon::protocol::master;
12 
13 ParallelServerArrayMediator::ParallelServerArrayMediator()
14  : super(),
16 {
18 }
20 {
21  //STARTS EACH SYSTEM ASYNCHRONOUSLY
22  array<thread, 2> threadArray =
23  {
24  thread
25  (
26  [this]()
27  {
28  super::start();
29  }
30  ),
31  thread
32  (
33  [this]()
34  {
36  }
37  )
38  };
39 
40  //HOWEVER, THIS START IS SYNCHRONOUS
41  for (size_t i = 0; i < threadArray.size(); i++)
42  threadArray[i].join();
43 }
An array of ExternalSystem(s).
virtual void start() override
Start interaction.
Package for external system, within the framework of master.
Definition: RWMutex.hpp:4
Package of libraries.
Definition: library.hpp:84
Package of network protocol and libraries.
Definition: protocol.hpp:185
ParallelSlaveSystemMediator * slave
A slave system for mediation.