I thought about the overall design of UA today:
Socket a thread,. Signaling parses a thread, ... each thread.
I also need to establish a monitoring thread to monitor whether the thread has a heartbeat.
It is also necessary to establish a master module. To manage each module, if there is a line of death, it will kill the dead thread. Start a similar type of thread.
How do you start it again, each module thread builds a data storage variable, separated from the thread, just copy this variable to the new thread. Of course, not completely copy, you will die.
What should the master module die? This is trouble .........
Oh, I will start the two main control modules first, and an alternate does not run. When the monitoring thread discovers that the master is also dead, start the standby master.
However, the master module copies it to the alternate thread every time a message.
This is a very metamorphosis!
This design has a dynamic fault-tolerant mode, which is generally a design method that requires extremely high stability.
-------------------------------
| | | | | |
| Server | --------> | BACKUP SRV |
-------------------------------
| /
| /
V v
------------------------------
| | | | | |
| Other | | Other |
------------------------------
It is also considered portability and re-enclosing the Linux API to use.
There is still memory to be managed. Design a memory recycle station.