Programming Languages · Python · Root

understand twisted deferred (1)

Deferred is a type of object designed to do one thing only: encode the execution order as callback-based and separately from the normal order of the python source codes. It does not deal with threads, parallelism, signals or subprecesses.It does not no know anything about an event loop, greenlets or scheduling. All it knows is what order… Continue reading understand twisted deferred (1)

C++ · Root

Recurisive Include file

Just used to remember self In JackieApplication.h file, #include “JackieIPlugin.h” In JackieIPlugin.h file, #include “JackieApplication.h” this case is called loop-include will cause compile error, How to fixed? In either  JackieApplication.h file or JackieIPlugin.h file, forward decelerate the other type header file like this: In JackieIPlugin.h file, class JackieApplication; …….. /// other things In JackieIPlugin.cpp file #include… Continue reading Recurisive Include file

C++ · Source Codes Analysis

ACE (1) Logging

must add -DACE_NTRACE=0 when compiling. a) the whole process only allows LM_ERROR and LM_WARNING ACE_DEBUG((LM_DEBUG, “Debug Text1\n”)); ACE_DEBUG((LM_ERROR, “Error Text1\n”)); ACE_LOG_MSG->priority_mask (LM_ERROR | LM_WARNING, ACE_Log_Msg::PROCESS); ACE_DEBUG((LM_DEBUG, “Debug Text2\n”)); ACE_DEBUG((LM_ERROR, “Error Text2\n”)); Or: ACE_DEBUG((LM_DEBUG, “Debug Text1\n”)); ACE_DEBUG((LM_ERROR, “Error Text1\n”)); /* Disable all logging severity in the process*/ ACE_LOG_MSG->priority_mask (0, ACE_Log_Msg::PROCESS); ACE_Log_Msg::enable_debug_messages (LM_ERROR); ACE_Log_Msg::enable_debug_messages (LM_WARNING); ACE_DEBUG((LM_DEBUG, “Debug… Continue reading ACE (1) Logging

C++ · Root

C++ MemoryPool (1)

1.1 The disadvantages of default memory allocation function Sometimes, default new and delete is not suitable to certain software for it can cause memory fragments. In this case,  a custom memory pool(mp) is much better and more efficient. 1.2  Types of mp An application can invoke system memory allocation to apply for a branch of memory as memory pool. After that, the application will allocate and release based on this memory pool. The only chance to allocate more memory by calling system allocation function  happens when we need to widen the memory pool. the custom memory pool are different when applied in different case. In term of the thread, there are single thread mp and   multi threads mp. In term of memory allocation unit, there are fixed -size  mp and dynamic mp where fixed-size mp is more efficient.  1.3 Justifications of mp 1.3.1 Fixed-size mpz                           As you can see, there are 4 memory branches in this mp, each branch having 3 equal units and one header data area that marks which unit is available currently.… Continue reading C++ MemoryPool (1)