* include/sys/strace.h: Define _STRACE_SPECIAL.
(strace_printf_wrap): Fix NOSTRACE definitions. (strace_printf_wrap1): Fix NOSTRACE definitions. (special_printf): Define. * thread.cc: Perform minor syntax fix in a comment. Rename "is_good_initialzer*" to "is_initializer*" throughout. Use pthread_printf rather than debug_printf throughout. Add extra pthread_printf debugging throughout. (pthread_mutex::_new_mutex): New constant value. (pthread_mutex::_unlocked_mutex): Ditto. (pthread_mutex::_destroyed_mutex): Ditto. (pthread_mutex::no_owner): Define new function. (pthread_mutex::can_be_unlocked): Detect no_owner situation. Handle PTHREAD_MUTEX_NORMAL as a special case. (pthread::create_cancel_event): Use C++ boolean values. (pthread::precreate): Use method to set mutex type. (pthread_cond::pthread_cond): Ditto. (pthread_rwlock::pthread_rwlock): Ditto. (pthread_mutex::pthread_mutex): Set owner to _new_mutex initially. (pthread_mutex::~pthread_mutex): Reset various elements to make it clearer if they are incorrectly reused. (pthread_mutex::lock): Add clarifying comment. (pthread_mutex::unlock): Attempt to handle various mutex types correctly. In particular, reinstate ability to have one thread unlock another thread's mutex if type == PTHREAD_MUTEX_NORMAL. (semaphore::_fixup_after_fork): Avoid redundancy. (pthread_mutex::_fixup_after_fork): Ditto. Fix debugging statement. (__pthread_cond_dowait): Accommodate changes to remove previously inexplicable use can_be_unblocked() as a static function. * thread.h: Rename "is_good_initialzer*" to "is_initializer*" throughout. (pthread_mutex): Reorganize. Make many things private. (pthread_mutex::no_owner): Define new method. (pthread_mutex::_new_mutex): Define new constant. (pthread_mutex::_unlocked_mutex): Ditto. (pthread_mutex::_destroyed_mutex): Ditto.
This commit is contained in:
@ -64,26 +64,27 @@ extern strace strace;
|
||||
|
||||
/* Bitmasks of tracing messages to print. */
|
||||
|
||||
#define _STRACE_ALL 0x00001 // so behaviour of strace=1 is unchanged
|
||||
#define _STRACE_FLUSH 0x00002 // flush output buffer after every message
|
||||
#define _STRACE_INHERIT 0x00004 // children inherit mask from parent
|
||||
#define _STRACE_UHOH 0x00008 // unusual or weird phenomenon
|
||||
#define _STRACE_SYSCALL 0x00010 // system calls
|
||||
#define _STRACE_STARTUP 0x00020 // argc/envp printout at startup
|
||||
#define _STRACE_DEBUG 0x00040 // info to help debugging
|
||||
#define _STRACE_PARANOID 0x00080 // paranoid info
|
||||
#define _STRACE_TERMIOS 0x00100 // info for debugging termios stuff
|
||||
#define _STRACE_SELECT 0x00200 // info on ugly select internals
|
||||
#define _STRACE_WM 0x00400 // trace windows messages (enable _strace_wm)
|
||||
#define _STRACE_SIGP 0x00800 // trace signal and process handling
|
||||
#define _STRACE_MINIMAL 0x01000 // very minimal strace output
|
||||
#define _STRACE_PTHREAD 0x02000 // pthread calls
|
||||
#define _STRACE_EXITDUMP 0x04000 // dump strace cache on exit
|
||||
#define _STRACE_SYSTEM 0x08000 // cache strace messages
|
||||
#define _STRACE_NOMUTEX 0x10000 // don't use mutex for synchronization
|
||||
#define _STRACE_MALLOC 0x20000 // trace malloc calls
|
||||
#define _STRACE_THREAD 0x40000 // cygthread calls
|
||||
#define _STRACE_NOTALL 0x80000 // don't include if _STRACE_ALL
|
||||
#define _STRACE_ALL 0x000001 // so behaviour of strace=1 is unchanged
|
||||
#define _STRACE_FLUSH 0x000002 // flush output buffer after every message
|
||||
#define _STRACE_INHERIT 0x000004 // children inherit mask from parent
|
||||
#define _STRACE_UHOH 0x000008 // unusual or weird phenomenon
|
||||
#define _STRACE_SYSCALL 0x000010 // system calls
|
||||
#define _STRACE_STARTUP 0x000020 // argc/envp printout at startup
|
||||
#define _STRACE_DEBUG 0x000040 // info to help debugging
|
||||
#define _STRACE_PARANOID 0x000080 // paranoid info
|
||||
#define _STRACE_TERMIOS 0x000100 // info for debugging termios stuff
|
||||
#define _STRACE_SELECT 0x000200 // info on ugly select internals
|
||||
#define _STRACE_WM 0x000400 // trace windows messages (enable _strace_wm)
|
||||
#define _STRACE_SIGP 0x000800 // trace signal and process handling
|
||||
#define _STRACE_MINIMAL 0x001000 // very minimal strace output
|
||||
#define _STRACE_PTHREAD 0x002000 // pthread calls
|
||||
#define _STRACE_EXITDUMP 0x004000 // dump strace cache on exit
|
||||
#define _STRACE_SYSTEM 0x008000 // cache strace messages
|
||||
#define _STRACE_NOMUTEX 0x010000 // don't use mutex for synchronization
|
||||
#define _STRACE_MALLOC 0x020000 // trace malloc calls
|
||||
#define _STRACE_THREAD 0x040000 // cygthread calls
|
||||
#define _STRACE_NOTALL 0x080000 // don't include if _STRACE_ALL
|
||||
#define _STRACE_SPECIAL 0x100000 // special case, only for debugging - do not check in
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -99,8 +100,8 @@ void strace_printf (unsigned, const char *func, const char *, ...);
|
||||
#ifdef __cplusplus
|
||||
|
||||
#ifdef NOSTRACE
|
||||
#define define_strace(c, f)
|
||||
#define define_strace1(c, f)
|
||||
#define strace_printf_wrap(what, fmt, args...)
|
||||
#define strace_printf_wrap1(what, fmt, args...)
|
||||
#else
|
||||
#define strace_printf_wrap(what, fmt, args...) \
|
||||
((void) ({\
|
||||
@ -114,6 +115,7 @@ void strace_printf (unsigned, const char *func, const char *, ...);
|
||||
strace.prntf((_STRACE_ ## what) | _STRACE_NOTALL, __PRETTY_FUNCTION__, fmt, ## args); \
|
||||
0; \
|
||||
}))
|
||||
#endif /*NOSTRACE*/
|
||||
|
||||
#define debug_printf(fmt, args...) strace_printf_wrap(DEBUG, fmt , ## args)
|
||||
#define malloc_printf(fmt, args...) strace_printf_wrap1(MALLOC, fmt , ## args)
|
||||
@ -126,7 +128,7 @@ void strace_printf (unsigned, const char *func, const char *, ...);
|
||||
#define system_printf(fmt, args...) strace_printf_wrap(SYSTEM, fmt , ## args)
|
||||
#define termios_printf(fmt, args...) strace_printf_wrap(TERMIOS, fmt , ## args)
|
||||
#define thread_printf(fmt, args...) strace_printf_wrap1(THREAD, fmt , ## args)
|
||||
#define special_printf(fmt, args...) strace_printf_wrap1(SPECIAL, fmt , ## args)
|
||||
#define wm_printf(fmt, args...) strace_printf_wrap(WM, fmt , ## args)
|
||||
#endif /*NOSTRACE*/
|
||||
#endif /* __cplusplus */
|
||||
#endif /* _SYS_STRACE_H */
|
||||
|
Reference in New Issue
Block a user