debuglog.h

来自「用UDP写的可靠传输程序源代码,非常有借鉴意义,适合互连网通讯」· C头文件 代码 · 共 37 行

H
37
字号
// Macrodefinitions for building debug logs
// Declaration file
//
// (c) Lev Naumov, CAMEL Laboratory
// E-mail: camellab@mail.ru
// For more information see http://camel.ifmo.ru or
// http://www.codeproject.com/internet/ctp.asp
/////////////////////////////////////////////////////////////////////////////

//#define DEBUG_LOG

// Deadlocks logging

#ifdef DEBUG_LOG

#define LOCK(x) TRACE2("1: Try lock   at %s (%d)\n",__FILE__,__LINE__); x.Lock(); TRACE2("2: Locked     at %s (%d)\n",__FILE__,__LINE__);
#define UNLOCK(x) TRACE2("3: Try unlock at %s (%d)\n",__FILE__,__LINE__); x.Unlock(); TRACE2("4: Unlocked   at %s (%d)\n",__FILE__,__LINE__);

#else

#define LOCK(x) x.Lock()
#define UNLOCK(x) x.Unlock()

#endif

// Checks if pointer p is valid or not

#ifdef _DEBUG

#define VALID(p) (p || (unsigned int)p==0xcdcdcdcd)

#else

#define VALID(p) (p)

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?