Add AIThreadID - Cleanup of apr_os_thread* related code.
Apart from just really cleaning things up and moving everything into one class regarding thread IDs (ie, is_main_thread(), comparing ID's etc), this also fixes an obscure bug where LL was casting thread ID's to U32 and then compared those to find out if it the same thread. It's theoretically possible that such fails on a 64bit OS. By generalizing the interface, I adopted the use of a thread-local cache for the current thread ID as used by LLMutex et al, so now all code benefits from that. The idea was even extended to now also be used for is_main_thread() tests and even resetting a thread ID to the ID of the current thread.
This commit is contained in:
@@ -49,6 +49,7 @@
|
||||
#else // LL_COMMON_LINK_SHARED
|
||||
#error LL_COMMON_LINK_SHARED not defined
|
||||
#endif // LL_COMMON_LINK_SHARED
|
||||
#include "aithreadid.h"
|
||||
|
||||
// If CWDEBUG is not defined, but DEBUG_CURLIO is, then replace
|
||||
// some of the cwd macro's with something that generates viewer
|
||||
@@ -104,23 +105,23 @@ struct fake_channel {
|
||||
void on() const { }
|
||||
void off() const { }
|
||||
};
|
||||
extern CWD_API fake_channel const warning;
|
||||
extern CWD_API fake_channel const curl;
|
||||
extern CWD_API fake_channel const curlio;
|
||||
extern CWD_API fake_channel const statemachine;
|
||||
extern CWD_API fake_channel const notice;
|
||||
extern LL_COMMON_API fake_channel const warning;
|
||||
extern LL_COMMON_API fake_channel const curl;
|
||||
extern LL_COMMON_API fake_channel const curlio;
|
||||
extern LL_COMMON_API fake_channel const statemachine;
|
||||
extern LL_COMMON_API fake_channel const notice;
|
||||
|
||||
} // namespace dc
|
||||
} // namespace debug
|
||||
|
||||
#define Debug(x) do { using namespace debug; x; } while(0)
|
||||
#define Dout(a, b) do { using namespace debug; if ((a).mOn) { llinfos_nf << (a).mLabel << ": " << Indent::print << b << llendl; } } while(0)
|
||||
#define Dout(a, b) do { using namespace debug; if ((a).mOn) { llinfos_nf << AIThreadID::DoutPrint << (a).mLabel << ": " << Indent::print << b << llendl; } } while(0)
|
||||
#define DoutEntering(a, b) \
|
||||
int __slviewer_debug_indentation = 2; \
|
||||
{ \
|
||||
using namespace debug; \
|
||||
if ((a).mOn) \
|
||||
llinfos_nf << (a).mLabel << ": " << Indent::print << "Entering " << b << llendl; \
|
||||
llinfos_nf << AIThreadID::DoutPrint << (a).mLabel << ": " << Indent::print << "Entering " << b << llendl; \
|
||||
else \
|
||||
__slviewer_debug_indentation = 0; \
|
||||
} \
|
||||
|
||||
Reference in New Issue
Block a user