diff options
author | Trumeet <yuuta@yuuta.moe> | 2022-07-27 16:23:22 -0700 |
---|---|---|
committer | Trumeet <yuuta@yuuta.moe> | 2022-07-27 16:23:22 -0700 |
commit | 1b9b47ddce6d9e17029efc79a459a7eb3238628c (patch) | |
tree | d36a765553fc00ae1a489cf80b236c643c05b35d /client/acronc/log.c | |
parent | bf83b67c68f3111ea42e2916cb1ba782fe1e1a24 (diff) | |
download | acron-1b9b47ddce6d9e17029efc79a459a7eb3238628c.tar acron-1b9b47ddce6d9e17029efc79a459a7eb3238628c.tar.gz acron-1b9b47ddce6d9e17029efc79a459a7eb3238628c.tar.bz2 acron-1b9b47ddce6d9e17029efc79a459a7eb3238628c.zip |
feat(acronc): add Windows support
Diffstat (limited to 'client/acronc/log.c')
-rw-r--r-- | client/acronc/log.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/client/acronc/log.c b/client/acronc/log.c index 08f48b6..feda8c2 100644 --- a/client/acronc/log.c +++ b/client/acronc/log.c @@ -11,10 +11,12 @@ #include <stdarg.h> #include <assert.h> -#ifdef __linux__ +#if defined(__linux__) #include <sys/types.h> #include <unistd.h> #include <sys/syscall.h> +#elif defined(_WIN32) +#include <windows.h> #endif void g_log(enum log_level level, @@ -48,8 +50,10 @@ void g_log(enum log_level level, assert(0); } int tid = -1; -#ifdef __linux__ +#if defined(__linux__) tid = (int) syscall(__NR_gettid); +#elif defined(_WIN32) + tid = (int) GetCurrentThreadId(); #endif fprintf(stream, "[%d %s:%d]: ", tid, file, line); |