From: Michael Jeanson Date: Tue, 11 Jul 2017 19:58:32 +0000 (-0400) Subject: Port: Add Cygwin tid support to logging X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=f61ad75488270a7c052714453bb27d6e043867db Port: Add Cygwin tid support to logging Signed-off-by: Michael Jeanson Signed-off-by: Jérémie Galarneau --- diff --git a/logging/log.c b/logging/log.c index adac547e..e31f867e 100644 --- a/logging/log.c +++ b/logging/log.c @@ -7,6 +7,10 @@ #include #include +#ifdef __CYGWIN__ +extern unsigned long pthread_getsequence_np(pthread_t *); +#endif + /* When defined, Android log (android/log.h) will be used by default instead of * stderr (ignored on non-Android platforms). Date, time, pid and tid (context) * will be provided by Android log. Android log features will be used to output @@ -823,6 +827,9 @@ static void pid_callback(int *const pid, int *const tid) #else #if defined(_WIN32) || defined(_WIN64) *tid = GetCurrentThreadId(); + #elif defined(__CYGWIN__) + pthread_t thr = pthread_self(); + *tid = (int)pthread_getsequence_np(&thr); #elif defined(__ANDROID__) *tid = gettid(); #elif defined(__linux__)