Last active
July 4, 2016 08:40
-
-
Save arajkumar/d98527d6706ea2089b33 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifdef _MSC_VER | |
| #include <windows.h> | |
| #define gettid() ::GetCurrentThreadId() | |
| #else | |
| #include <stdio.h> | |
| #include <sys/syscall.h> | |
| #include <unistd.h> | |
| #define gettid() syscall(SYS_gettid) | |
| #endif | |
| #include <stdio.h> | |
| #define pri(x, ...) do {\ | |
| fprintf(stderr, "|%s:%d:tid(%ld)|", __FUNCTION__, __LINE__, gettid());\ | |
| fprintf(stderr, "{");\ | |
| fprintf(stderr, x, ## __VA_ARGS__);\ | |
| fprintf(stderr, "}\n");\ | |
| fflush(stderr);\ | |
| } while(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment