Skip to content

Commit

Permalink
Fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gecko0307 committed Aug 30, 2023
1 parent 80b15b5 commit 3cf41dc
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions dlib/core/thread.d
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ module dlib.core.thread;
version(Windows)
{
extern(Windows):

alias HANDLE = void*;

struct SECURITY_ATTRIBUTES
{
Expand All @@ -58,36 +60,36 @@ version(Windows)
int bInheritHandle;
}

alias LPTHREAD_START_ROUTINE = extern(Windows) uint function(in void*);
alias LPTHREAD_START_ROUTINE = extern(Windows) uint function(const(void)*);

void* CreateThread(
in SECURITY_ATTRIBUTES* lpThreadAttributes,
in size_t dwStackSize,
in LPTHREAD_START_ROUTINE lpStartAddress,
in void* lpParameter,
in uint dwCreationFlags,
uint* lpThreadId
const(SECURITY_ATTRIBUTES)* lpThreadAttributes,
size_t dwStackSize,
LPTHREAD_START_ROUTINE lpStartAddress,
void* lpParameter,
uint dwCreationFlags,
uint* lpThreadId
);

uint WaitForMultipleObjects(
in uint nCount,
in void** lpHandles,
in int bWaitAll,
in uint dwMilliseconds
uint nCount,
const(HANDLE)* lpHandles,
int bWaitAll,
uint dwMilliseconds
);

int TerminateThread(
void* hThread,
in uint dwExitCode
const(void)* hThread,
uint dwExitCode
);

int GetExitCodeThread(
in void* hThread,
const(void)* hThread,
uint* lpExitCode
);

int CloseHandle(
in void* hObject
const(void)* hObject
);

enum INFINITE = uint.max;
Expand Down Expand Up @@ -188,7 +190,7 @@ class Thread
{
version(Windows)
{
WaitForMultipleObjects(1, &winThread, 1, INFINITE);
WaitForMultipleObjects(1u, &winThread, 1, INFINITE);
}

version(Posix)
Expand Down Expand Up @@ -230,7 +232,7 @@ class Thread

version(Windows)
{
extern(Windows) static uint winThreadFunc(in void* lpParam)
extern(Windows) static uint winThreadFunc(const(void)* lpParam)
{
Thread t = cast(Thread)lpParam;
if (t.callFunc)
Expand Down

0 comments on commit 3cf41dc

Please sign in to comment.