From fa0e3ff9541c55d6bd9e2360e1ebc88a94428856 Mon Sep 17 00:00:00 2001 From: "Davis E. King" Date: Sat, 27 Apr 2024 10:57:23 -0400 Subject: [PATCH] Hide windows.h in .cc file (#2952) --- dlib/misc_api/misc_api_kernel_1.cpp | 2 +- dlib/threads/threads_kernel_1.cpp | 9 +++++++++ dlib/threads/threads_kernel_1.h | 10 ++-------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/dlib/misc_api/misc_api_kernel_1.cpp b/dlib/misc_api/misc_api_kernel_1.cpp index f17d850e1..a40d83e02 100644 --- a/dlib/misc_api/misc_api_kernel_1.cpp +++ b/dlib/misc_api/misc_api_kernel_1.cpp @@ -11,8 +11,8 @@ #include "misc_api_kernel_1.h" #include "../windows_magic.h" -#include #include +#include // tell visual studio to link to the library needed to call timeGetTime() #ifdef _MSC_VER diff --git a/dlib/threads/threads_kernel_1.cpp b/dlib/threads/threads_kernel_1.cpp index cb36b8d3f..178e9f5ac 100644 --- a/dlib/threads/threads_kernel_1.cpp +++ b/dlib/threads/threads_kernel_1.cpp @@ -9,11 +9,20 @@ #include "threads_kernel_1.h" +#include "../windows_magic.h" +#include + #include namespace dlib { + thread_id_type get_thread_id( + ) + { + return GetCurrentThreadId(); + } + namespace threads_kernel_shared_helpers { diff --git a/dlib/threads/threads_kernel_1.h b/dlib/threads/threads_kernel_1.h index 11acad5a5..426e6f023 100644 --- a/dlib/threads/threads_kernel_1.h +++ b/dlib/threads/threads_kernel_1.h @@ -9,8 +9,6 @@ #include "threads_kernel_abstract.h" -#include "../windows_magic.h" -#include #include "../algs.h" #include #include @@ -22,13 +20,9 @@ namespace dlib // ---------------------------------------------------------------------------------------- - typedef DWORD thread_id_type; + typedef unsigned long thread_id_type; - inline thread_id_type get_thread_id ( - ) - { - return GetCurrentThreadId(); - } + thread_id_type get_thread_id(); // ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------