Global Status, global immersive Status Bar
Translated from global State in http://aos?k.org/en/zeromq.html
It is not ideal to use global variables in the library. A library may be loaded many times by the program, but even so, there will only be a unique global variable set.
Figure24.1: Ø MQ being used by different libraries
In Figure 24.1, The ZeroMQ library is used for both different and independent databases, and then the application uses the two libraries.
In this case, both ZeroMQ instances access the same variables, which leads to competition conditions, strange errors, and undefined behavior.
To prevent this problem, the ZeroMQ library does not have global variables. instead, the user who uses the database is responsible for explicitly creating the global status. the object that contains the global state is called context. from the user's perspective, this context looks like a working thread pool. From ZeroMQ's perspective, it is just an object that stores some global states we need. in the preceding figure, libA has its own context, and libB also has its own context. one of them will not be damaged or overwrite the other.
The lesson here is very obvious: Do not use the global status in the database. if you do this, when the database happens to be instantiated twice by the same process, the database may crash.