Fix useage of volatile in casts.

svn path=/trunk/; revision=52246
This commit is contained in:
Timo Kreuzer 2011-06-15 13:33:48 +00:00
parent 62a75503e1
commit e15164f46a

View file

@ -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 */