Taming ace beast (1)

xiaoxiao2021-03-06  43

The topic is a bit forward, but it is called the beast.

I have seen a lot of long ACE, I haven't used it, I have had the opportunity to implement the SMGP protocol, so I want to use ACE to practice. The agreement is very simple, there is not much to say, mainly ACE applications, may not be a problem for some masters, but it should be a little help for the initial user.

My idea is to provide a basic API interface by providing static lib libraries and header files, namely Ace.lib-> smgp.lib -> *. EXE.

First, the Global Initialization of ACE will be performed, and the ACE will make the entry function main macro to ACE_MAIN_I, so when the program is running, the ACE_MAIN_I function will be entered, if not, some of the operations of the system will be wrong.

If you compile the static lib library, you need to define the ace_as_static_libs macro. Sometimes when using the template parameters, you will touch the number of compiled statements. The number of parameters do not match, this time you need to define the ace_has_template_typedefs macro, this macro The number of template parameters has been declared.

When using the timer, the owner of the reactor (ACE_REAACTOR) must be consistent with the thread of the final processing timing signal. For example, if the reactor instance is initialized in the main thread, the reactor is registered in another thread, then this timer is ultimately not working, only the reactor is specified in the thread of the required timer. The owner is current thread so that the timer will take effect.

Note the difference between Lock and Synch, what kind of occasions are applicable, don't confuse.

转载请注明原文地址:https://www.9cbs.com/read-57485.html

New Post(0)