From e15164f46a1d727cf1a4ba2e1d1fbd556a3638bf Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 15 Jun 2011 13:33:48 +0000 Subject: [PATCH] [RTL] Fix useage of volatile in casts. svn path=/trunk/; revision=52246 --- reactos/lib/rtl/workitem.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/reactos/lib/rtl/workitem.c b/reactos/lib/rtl/workitem.c index c74aea8b48d..cb6c83ab35a 100644 --- a/reactos/lib/rtl/workitem.c +++ b/reactos/lib/rtl/workitem.c @@ -45,7 +45,7 @@ static LONG ThreadPoolIOWorkerThreads; static LONG ThreadPoolIOWorkerThreadsRequests; static LONG ThreadPoolIOWorkerThreadsLongRequests; -#define IsThreadPoolInitialized() ((volatile LONG)ThreadPoolInitialized == 1) +#define IsThreadPoolInitialized() (*((volatile LONG*)&ThreadPoolInitialized) == 1) static NTSTATUS RtlpInitializeThreadPool(VOID) @@ -614,8 +614,8 @@ Wait: /* FIXME - figure out an effective method to determine if it's appropriate to lower the number of threads. For now let's always terminate if there's at least one thread and no queued items. */ - Terminate = ((volatile LONG)ThreadPoolIOWorkerThreads - (volatile LONG)ThreadPoolIOWorkerThreadsLongRequests >= WORKERTHREAD_CREATION_THRESHOLD) && - ((volatile LONG)ThreadPoolIOWorkerThreadsRequests == 0); + Terminate = (*((volatile LONG*)&ThreadPoolIOWorkerThreads) - *((volatile LONG*)&ThreadPoolIOWorkerThreadsLongRequests) >= WORKERTHREAD_CREATION_THRESHOLD) && + (*((volatile LONG*)&ThreadPoolIOWorkerThreadsRequests) == 0); if (Terminate) { @@ -718,7 +718,7 @@ RtlpWorkerThreadProc(IN PVOID Parameter) { /* FIXME - we might want to optimize this */ if (TimeoutCount++ > 2 && - (volatile LONG)ThreadPoolWorkerThreads - (volatile LONG)ThreadPoolWorkerThreadsLongRequests >= WORKERTHREAD_CREATION_THRESHOLD) + *((volatile LONG*)&ThreadPoolWorkerThreads) - *((volatile LONG*)&ThreadPoolWorkerThreadsLongRequests) >= WORKERTHREAD_CREATION_THRESHOLD) { Terminate = TRUE; } @@ -819,7 +819,7 @@ RtlQueueWorkItem(IN WORKERCALLBACKFUNC Function, /* Grow the thread pool */ Status = RtlpStartWorkerThread(RtlpIoWorkerThreadProc); - if (!NT_SUCCESS(Status) && (volatile LONG)ThreadPoolIOWorkerThreads != 0) + if (!NT_SUCCESS(Status) && *((volatile LONG*)&ThreadPoolIOWorkerThreads) != 0) { /* We failed to create the thread, but there's at least one there so we can at least queue the request */ @@ -846,7 +846,7 @@ RtlQueueWorkItem(IN WORKERCALLBACKFUNC Function, /* Grow the thread pool */ Status = RtlpStartWorkerThread(RtlpWorkerThreadProc); - if (!NT_SUCCESS(Status) && (volatile LONG)ThreadPoolWorkerThreads != 0) + if (!NT_SUCCESS(Status) && *((volatile LONG*)&ThreadPoolWorkerThreads) != 0) { /* We failed to create the thread, but there's at least one there so we can at least queue the request */