[RTL]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Sun, 21 Nov 2010 10:05:20 +0000 (10:05 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sun, 21 Nov 2010 10:05:20 +0000 (10:05 +0000)
- Use portable interlocked functions in code, define them to intrinsics for x86 and x64 in the header

svn path=/branches/cmake-bringup/; revision=49680

lib/rtl/actctx.c
lib/rtl/critical.c
lib/rtl/rtl.h
lib/rtl/srw.c
lib/rtl/timerqueue.c
lib/rtl/vectoreh.c
lib/rtl/wait.c
lib/rtl/workitem.c

index 40883a8..d5a0d39 100644 (file)
@@ -575,12 +575,12 @@ static ACTIVATION_CONTEXT *check_actctx( HANDLE h )
 
 static inline void actctx_addref( ACTIVATION_CONTEXT *actctx )
 {
 
 static inline void actctx_addref( ACTIVATION_CONTEXT *actctx )
 {
-    _InterlockedExchangeAdd( &actctx->ref_count, 1 );
+    InterlockedExchangeAdd( &actctx->ref_count, 1 );
 }
 
 static void actctx_release( ACTIVATION_CONTEXT *actctx )
 {
 }
 
 static void actctx_release( ACTIVATION_CONTEXT *actctx )
 {
-    if (_InterlockedExchangeAdd( &actctx->ref_count, -1 ) == 1)
+    if (InterlockedExchangeAdd( &actctx->ref_count, -1 ) == 1)
     {
         unsigned int i, j;
 
     {
         unsigned int i, j;
 
index f166814..03bffca 100644 (file)
@@ -59,7 +59,7 @@ RtlpCreateCriticalSectionSem(PRTL_CRITICAL_SECTION CriticalSection)
 
                 /* We failed, this is bad... */
                 DPRINT1("Failed to Create Event!\n");
 
                 /* We failed, this is bad... */
                 DPRINT1("Failed to Create Event!\n");
-                _InterlockedDecrement(&CriticalSection->LockCount);
+                InterlockedDecrement(&CriticalSection->LockCount);
                 RtlRaiseStatus(Status);
                 return;
         }
                 RtlRaiseStatus(Status);
                 return;
         }
@@ -437,7 +437,7 @@ RtlEnterCriticalSection(PRTL_CRITICAL_SECTION CriticalSection)
     HANDLE Thread = (HANDLE)NtCurrentTeb()->ClientId.UniqueThread;
 
     /* Try to Lock it */
     HANDLE Thread = (HANDLE)NtCurrentTeb()->ClientId.UniqueThread;
 
     /* Try to Lock it */
-    if (_InterlockedIncrement(&CriticalSection->LockCount) != 0) {
+    if (InterlockedIncrement(&CriticalSection->LockCount) != 0) {
 
         /*
          * We've failed to lock it! Does this thread
 
         /*
          * We've failed to lock it! Does this thread
@@ -621,7 +621,7 @@ RtlLeaveCriticalSection(PRTL_CRITICAL_SECTION CriticalSection)
     if (--CriticalSection->RecursionCount) {
 
         /* Someone still owns us, but we are free. This needs to be done atomically. */
     if (--CriticalSection->RecursionCount) {
 
         /* Someone still owns us, but we are free. This needs to be done atomically. */
-        _InterlockedDecrement(&CriticalSection->LockCount);
+        InterlockedDecrement(&CriticalSection->LockCount);
 
     } else {
 
 
     } else {
 
@@ -630,7 +630,7 @@ RtlLeaveCriticalSection(PRTL_CRITICAL_SECTION CriticalSection)
         CriticalSection->OwningThread = 0;
 
         /* Was someone wanting us? This needs to be done atomically. */
         CriticalSection->OwningThread = 0;
 
         /* Was someone wanting us? This needs to be done atomically. */
-        if (-1 != _InterlockedDecrement(&CriticalSection->LockCount)) {
+        if (-1 != InterlockedDecrement(&CriticalSection->LockCount)) {
 
             /* Let him have us */
             RtlpUnWaitCriticalSection(CriticalSection);
 
             /* Let him have us */
             RtlpUnWaitCriticalSection(CriticalSection);
@@ -662,7 +662,7 @@ NTAPI
 RtlTryEnterCriticalSection(PRTL_CRITICAL_SECTION CriticalSection)
 {
     /* Try to take control */
 RtlTryEnterCriticalSection(PRTL_CRITICAL_SECTION CriticalSection)
 {
     /* Try to take control */
-    if (_InterlockedCompareExchange(&CriticalSection->LockCount,
+    if (InterlockedCompareExchange(&CriticalSection->LockCount,
                                     0,
                                     -1) == -1) {
 
                                     0,
                                     -1) == -1) {
 
@@ -674,7 +674,7 @@ RtlTryEnterCriticalSection(PRTL_CRITICAL_SECTION CriticalSection)
    } else if (CriticalSection->OwningThread == NtCurrentTeb()->ClientId.UniqueThread) {
 
         /* It's already ours */
    } else if (CriticalSection->OwningThread == NtCurrentTeb()->ClientId.UniqueThread) {
 
         /* It's already ours */
-        _InterlockedIncrement(&CriticalSection->LockCount);
+        InterlockedIncrement(&CriticalSection->LockCount);
         CriticalSection->RecursionCount++;
         return TRUE;
     }
         CriticalSection->RecursionCount++;
         return TRUE;
     }
index 3d10deb..fe33352 100644 (file)
 
 #include <intrin.h>
 
 
 #include <intrin.h>
 
+/* Use intrinsics for x86 and x64 */
+#if defined(_M_IX86) || defined(_M_AMD64)
+#define InterlockedCompareExchange _InterlockedCompareExchange
+#define InterlockedIncrement _InterlockedIncrement
+#define InterlockedDecrement _InterlockedDecrement
+#define InterlockedExchangeAdd _InterlockedExchangeAdd
+#endif
+
 #endif /* RTL_H */
 
 /* EOF */
 #endif /* RTL_H */
 
 /* EOF */
index d41e154..3c37a83 100644 (file)
@@ -131,7 +131,7 @@ RtlpReleaseWaitBlockLockExclusive(IN OUT PRTL_SRWLOCK SRWLock,
         }
     }
 
         }
     }
 
-    (void)_InterlockedExchange((PLONG)&SRWLock->Ptr, NewValue);
+    (void)InterlockedExchange((PLONG)&SRWLock->Ptr, NewValue);
 
     if (FirstWaitBlock->Exclusive)
     {
 
     if (FirstWaitBlock->Exclusive)
     {
@@ -186,7 +186,7 @@ RtlpReleaseWaitBlockLockLastShared(IN OUT PRTL_SRWLOCK SRWLock,
         NewValue = RTL_SRWLOCK_OWNED;
     }
 
         NewValue = RTL_SRWLOCK_OWNED;
     }
 
-    (void)_InterlockedExchange((PLONG)&SRWLock->Ptr, NewValue);
+    (void)InterlockedExchange((PLONG)&SRWLock->Ptr, NewValue);
 
     (void)InterlockedOr(&FirstWaitBlock->Wake,
                         TRUE);
 
     (void)InterlockedOr(&FirstWaitBlock->Wake,
                         TRUE);
@@ -420,7 +420,7 @@ RtlAcquireSRWLockShared(IN OUT PRTL_SRWLOCK SRWLock)
                 NewValue = (CurrentValue >> RTL_SRWLOCK_BITS) + 1;
                 NewValue = (NewValue << RTL_SRWLOCK_BITS) | (CurrentValue & RTL_SRWLOCK_MASK);
 
                 NewValue = (CurrentValue >> RTL_SRWLOCK_BITS) + 1;
                 NewValue = (NewValue << RTL_SRWLOCK_BITS) | (CurrentValue & RTL_SRWLOCK_MASK);
 
-                if (_InterlockedCompareExchange((PLONG)&SRWLock->Ptr,
+                if (InterlockedCompareExchange((PLONG)&SRWLock->Ptr,
                                                 NewValue,
                                                 CurrentValue) == CurrentValue)
                 {
                                                 NewValue,
                                                 CurrentValue) == CurrentValue)
                 {
@@ -499,7 +499,7 @@ RtlAcquireSRWLockShared(IN OUT PRTL_SRWLOCK SRWLock)
                     ASSERT_SRW_WAITBLOCK(&StackWaitBlock);
 
                     NewValue = (ULONG_PTR)&StackWaitBlock | RTL_SRWLOCK_OWNED | RTL_SRWLOCK_CONTENDED;
                     ASSERT_SRW_WAITBLOCK(&StackWaitBlock);
 
                     NewValue = (ULONG_PTR)&StackWaitBlock | RTL_SRWLOCK_OWNED | RTL_SRWLOCK_CONTENDED;
-                    if (_InterlockedCompareExchange((PLONG)&SRWLock->Ptr,
+                    if (InterlockedCompareExchange((PLONG)&SRWLock->Ptr,
                                                     NewValue,
                                                     CurrentValue) == CurrentValue)
                     {
                                                     NewValue,
                                                     CurrentValue) == CurrentValue)
                     {
@@ -521,7 +521,7 @@ RtlAcquireSRWLockShared(IN OUT PRTL_SRWLOCK SRWLock)
                    RTL_SRWLOCK_SHARED nor the RTL_SRWLOCK_OWNED bit is set */
                 ASSERT(!(CurrentValue & RTL_SRWLOCK_CONTENDED));
 
                    RTL_SRWLOCK_SHARED nor the RTL_SRWLOCK_OWNED bit is set */
                 ASSERT(!(CurrentValue & RTL_SRWLOCK_CONTENDED));
 
-                if (_InterlockedCompareExchange((PLONG)&SRWLock->Ptr,
+                if (InterlockedCompareExchange((PLONG)&SRWLock->Ptr,
                                                 NewValue,
                                                 CurrentValue) == CurrentValue)
                 {
                                                 NewValue,
                                                 CurrentValue) == CurrentValue)
                 {
@@ -580,7 +580,7 @@ RtlReleaseSRWLockShared(IN OUT PRTL_SRWLOCK SRWLock)
                     NewValue = (NewValue << RTL_SRWLOCK_BITS) | RTL_SRWLOCK_SHARED | RTL_SRWLOCK_OWNED;
                 }
 
                     NewValue = (NewValue << RTL_SRWLOCK_BITS) | RTL_SRWLOCK_SHARED | RTL_SRWLOCK_OWNED;
                 }
 
-                if (_InterlockedCompareExchange((PLONG)&SRWLock->Ptr,
+                if (InterlockedCompareExchange((PLONG)&SRWLock->Ptr,
                                                 NewValue,
                                                 CurrentValue) == CurrentValue)
                 {
                                                 NewValue,
                                                 CurrentValue) == CurrentValue)
                 {
@@ -639,7 +639,7 @@ RtlAcquireSRWLockExclusive(IN OUT PRTL_SRWLOCK SRWLock)
 
                     NewValue = (ULONG_PTR)&StackWaitBlock | RTL_SRWLOCK_SHARED | RTL_SRWLOCK_CONTENDED | RTL_SRWLOCK_OWNED;
 
 
                     NewValue = (ULONG_PTR)&StackWaitBlock | RTL_SRWLOCK_SHARED | RTL_SRWLOCK_CONTENDED | RTL_SRWLOCK_OWNED;
 
-                    if (_InterlockedCompareExchange((PLONG)&SRWLock->Ptr,
+                    if (InterlockedCompareExchange((PLONG)&SRWLock->Ptr,
                                                     NewValue,
                                                     CurrentValue) == CurrentValue)
                     {
                                                     NewValue,
                                                     CurrentValue) == CurrentValue)
                     {
@@ -697,7 +697,7 @@ AddWaitBlock:
                         ASSERT_SRW_WAITBLOCK(&StackWaitBlock);
 
                         NewValue = (ULONG_PTR)&StackWaitBlock | RTL_SRWLOCK_OWNED | RTL_SRWLOCK_CONTENDED;
                         ASSERT_SRW_WAITBLOCK(&StackWaitBlock);
 
                         NewValue = (ULONG_PTR)&StackWaitBlock | RTL_SRWLOCK_OWNED | RTL_SRWLOCK_CONTENDED;
-                        if (_InterlockedCompareExchange((PLONG)&SRWLock->Ptr,
+                        if (InterlockedCompareExchange((PLONG)&SRWLock->Ptr,
                                                         NewValue,
                                                         CurrentValue) == CurrentValue)
                         {
                                                         NewValue,
                                                         CurrentValue) == CurrentValue)
                         {
@@ -767,7 +767,7 @@ RtlReleaseSRWLockExclusive(IN OUT PRTL_SRWLOCK SRWLock)
                 ASSERT(!(CurrentValue & ~RTL_SRWLOCK_OWNED));
 
                 NewValue = 0;
                 ASSERT(!(CurrentValue & ~RTL_SRWLOCK_OWNED));
 
                 NewValue = 0;
-                if (_InterlockedCompareExchange((PLONG)&SRWLock->Ptr,
+                if (InterlockedCompareExchange((PLONG)&SRWLock->Ptr,
                                                 NewValue,
                                                 CurrentValue) == CurrentValue)
                 {
                                                 NewValue,
                                                 CurrentValue) == CurrentValue)
                 {
index 1cad82f..f3e3fcc 100644 (file)
@@ -372,7 +372,7 @@ static struct timer_queue *get_timer_queue(HANDLE TimerQueue)
             NTSTATUS status = RtlCreateTimerQueue(&q);
             if (status == STATUS_SUCCESS)
             {
             NTSTATUS status = RtlCreateTimerQueue(&q);
             if (status == STATUS_SUCCESS)
             {
-                PVOID p = _InterlockedCompareExchangePointer(
+                PVOID p = InterlockedCompareExchangePointer(
                     (void **) &default_timer_queue, q, NULL);
                 if (p)
                     /* Got beat to the punch.  */
                     (void **) &default_timer_queue, q, NULL);
                 if (p)
                     /* Got beat to the punch.  */
index 92ceade..7bcec18 100644 (file)
@@ -61,7 +61,7 @@ RtlCallVectoredExceptionHandlers(IN PEXCEPTION_RECORD  ExceptionRecord,
         if (--veh->Refs == 0)
         {
           RemoveEntryList (&veh->ListEntry);
         if (--veh->Refs == 0)
         {
           RemoveEntryList (&veh->ListEntry);
-          _InterlockedDecrement (&RtlpVectoredExceptionsInstalled);
+          InterlockedDecrement (&RtlpVectoredExceptionsInstalled);
           Remove = TRUE;
         }
         Ret = TRUE;
           Remove = TRUE;
         }
         Ret = TRUE;
@@ -74,7 +74,7 @@ RtlCallVectoredExceptionHandlers(IN PEXCEPTION_RECORD  ExceptionRecord,
       {
         CurrentEntry = veh->ListEntry.Flink;
         RemoveEntryList (&veh->ListEntry);
       {
         CurrentEntry = veh->ListEntry.Flink;
         RemoveEntryList (&veh->ListEntry);
-        _InterlockedDecrement (&RtlpVectoredExceptionsInstalled);
+        InterlockedDecrement (&RtlpVectoredExceptionsInstalled);
         RtlLeaveCriticalSection(&RtlpVectoredExceptionLock);
         
         RtlFreeHeap(RtlGetProcessHeap(),
         RtlLeaveCriticalSection(&RtlpVectoredExceptionLock);
         
         RtlFreeHeap(RtlGetProcessHeap(),
@@ -136,7 +136,7 @@ RtlAddVectoredExceptionHandler(IN ULONG FirstHandler,
       InsertTailList(&RtlpVectoredExceptionHead,
                      &veh->ListEntry);
     }
       InsertTailList(&RtlpVectoredExceptionHead,
                      &veh->ListEntry);
     }
-    _InterlockedIncrement (&RtlpVectoredExceptionsInstalled);
+    InterlockedIncrement (&RtlpVectoredExceptionsInstalled);
     RtlLeaveCriticalSection(&RtlpVectoredExceptionLock);
   }
 
     RtlLeaveCriticalSection(&RtlpVectoredExceptionLock);
   }
 
index 543d5a4..f825421 100644 (file)
@@ -91,7 +91,7 @@ Wait_thread_proc(LPVOID Arg)
     completion_event = Wait->CompletionEvent;
     if (completion_event) NtSetEvent( completion_event, NULL );
 
     completion_event = Wait->CompletionEvent;
     if (completion_event) NtSetEvent( completion_event, NULL );
 
-    if (_InterlockedIncrement( &Wait->DeleteCount ) == 2 )
+    if (InterlockedIncrement( &Wait->DeleteCount ) == 2 )
     {
        NtClose( Wait->CancelEvent );
        RtlFreeHeap( RtlGetProcessHeap(), 0, Wait );
     {
        NtClose( Wait->CancelEvent );
        RtlFreeHeap( RtlGetProcessHeap(), 0, Wait );
@@ -220,7 +220,7 @@ RtlDeregisterWaitEx(HANDLE WaitHandle,
                 if (Status != STATUS_SUCCESS)
                     return Status;
 
                 if (Status != STATUS_SUCCESS)
                     return Status;
 
-                (void)_InterlockedExchangePointer( &Wait->CompletionEvent, CompletionEvent );
+                (void)InterlockedExchangePointer( &Wait->CompletionEvent, CompletionEvent );
 
                 if (Wait->CallbackInProgress)
                     NtWaitForSingleObject( CompletionEvent, FALSE, NULL );
 
                 if (Wait->CallbackInProgress)
                     NtWaitForSingleObject( CompletionEvent, FALSE, NULL );
@@ -229,7 +229,7 @@ RtlDeregisterWaitEx(HANDLE WaitHandle,
             }
             else
             {
             }
             else
             {
-                (void)_InterlockedExchangePointer( &Wait->CompletionEvent, CompletionEvent );
+                (void)InterlockedExchangePointer( &Wait->CompletionEvent, CompletionEvent );
 
                 if (Wait->CallbackInProgress)
                     Status = STATUS_PENDING;
 
                 if (Wait->CallbackInProgress)
                     Status = STATUS_PENDING;
@@ -239,7 +239,7 @@ RtlDeregisterWaitEx(HANDLE WaitHandle,
             Status = STATUS_PENDING;
     }
 
             Status = STATUS_PENDING;
     }
 
-    if (_InterlockedIncrement( &Wait->DeleteCount ) == 2 )
+    if (InterlockedIncrement( &Wait->DeleteCount ) == 2 )
     {
         Status = STATUS_SUCCESS;
         NtClose( Wait->CancelEvent );
     {
         Status = STATUS_SUCCESS;
         NtClose( Wait->CancelEvent );
index 60f313c..c74aea8 100644 (file)
@@ -55,7 +55,7 @@ RtlpInitializeThreadPool(VOID)
 
     do
     {
 
     do
     {
-        InitStatus = _InterlockedCompareExchange(&ThreadPoolInitialized,
+        InitStatus = InterlockedCompareExchange(&ThreadPoolInitialized,
                                                  2,
                                                  0);
         if (InitStatus == 0)
                                                  2,
                                                  0);
         if (InitStatus == 0)
@@ -91,7 +91,7 @@ RtlpInitializeThreadPool(VOID)
 
 Finish:
             /* Initialization done */
 
 Finish:
             /* Initialization done */
-            _InterlockedExchange(&ThreadPoolInitialized,
+            InterlockedExchange(&ThreadPoolInitialized,
                                  1);
             break;
         }
                                  1);
             break;
         }
@@ -223,11 +223,11 @@ RtlpExecuteWorkItem(IN OUT PVOID NormalContext,
     }
 
     /* update the requests counter */
     }
 
     /* update the requests counter */
-    _InterlockedDecrement(&ThreadPoolWorkerThreadsRequests);
+    InterlockedDecrement(&ThreadPoolWorkerThreadsRequests);
 
     if (WorkItem.Flags & WT_EXECUTELONGFUNCTION)
     {
 
     if (WorkItem.Flags & WT_EXECUTELONGFUNCTION)
     {
-        _InterlockedDecrement(&ThreadPoolWorkerThreadsLongRequests);
+        InterlockedDecrement(&ThreadPoolWorkerThreadsLongRequests);
     }
 }
 
     }
 }
 
@@ -237,11 +237,11 @@ RtlpQueueWorkerThread(IN OUT PRTLP_WORKITEM WorkItem)
 {
     NTSTATUS Status = STATUS_SUCCESS;
 
 {
     NTSTATUS Status = STATUS_SUCCESS;
 
-    _InterlockedIncrement(&ThreadPoolWorkerThreadsRequests);
+    InterlockedIncrement(&ThreadPoolWorkerThreadsRequests);
 
     if (WorkItem->Flags & WT_EXECUTELONGFUNCTION)
     {
 
     if (WorkItem->Flags & WT_EXECUTELONGFUNCTION)
     {
-        _InterlockedIncrement(&ThreadPoolWorkerThreadsLongRequests);
+        InterlockedIncrement(&ThreadPoolWorkerThreadsLongRequests);
     }
 
     if (WorkItem->Flags & WT_EXECUTEINPERSISTENTTHREAD)
     }
 
     if (WorkItem->Flags & WT_EXECUTEINPERSISTENTTHREAD)
@@ -270,11 +270,11 @@ RtlpQueueWorkerThread(IN OUT PRTLP_WORKITEM WorkItem)
 
     if (!NT_SUCCESS(Status))
     {
 
     if (!NT_SUCCESS(Status))
     {
-        _InterlockedDecrement(&ThreadPoolWorkerThreadsRequests);
+        InterlockedDecrement(&ThreadPoolWorkerThreadsRequests);
 
         if (WorkItem->Flags & WT_EXECUTELONGFUNCTION)
         {
 
         if (WorkItem->Flags & WT_EXECUTELONGFUNCTION)
         {
-            _InterlockedDecrement(&ThreadPoolWorkerThreadsLongRequests);
+            InterlockedDecrement(&ThreadPoolWorkerThreadsLongRequests);
         }
     }
 
         }
     }
 
@@ -351,11 +351,11 @@ RtlpExecuteIoWorkItem(IN OUT PVOID NormalContext,
     }
 
     /* update the requests counter */
     }
 
     /* update the requests counter */
-    _InterlockedDecrement(&ThreadPoolIOWorkerThreadsRequests);
+    InterlockedDecrement(&ThreadPoolIOWorkerThreadsRequests);
 
     if (WorkItem.Flags & WT_EXECUTELONGFUNCTION)
     {
 
     if (WorkItem.Flags & WT_EXECUTELONGFUNCTION)
     {
-        _InterlockedDecrement(&ThreadPoolIOWorkerThreadsLongRequests);
+        InterlockedDecrement(&ThreadPoolIOWorkerThreadsLongRequests);
     }
 }
 
     }
 }
 
@@ -461,14 +461,14 @@ RtlpQueueIoWorkerThread(IN OUT PRTLP_WORKITEM WorkItem)
 
     ASSERT(IoThread != NULL);
 
 
     ASSERT(IoThread != NULL);
 
-    _InterlockedIncrement(&ThreadPoolIOWorkerThreadsRequests);
+    InterlockedIncrement(&ThreadPoolIOWorkerThreadsRequests);
 
     if (WorkItem->Flags & WT_EXECUTELONGFUNCTION)
     {
         /* We're about to queue a long function, mark the thread */
         IoThread->Flags |= WT_EXECUTELONGFUNCTION;
 
 
     if (WorkItem->Flags & WT_EXECUTELONGFUNCTION)
     {
         /* We're about to queue a long function, mark the thread */
         IoThread->Flags |= WT_EXECUTELONGFUNCTION;
 
-        _InterlockedIncrement(&ThreadPoolIOWorkerThreadsLongRequests);
+        InterlockedIncrement(&ThreadPoolIOWorkerThreadsLongRequests);
     }
 
     /* It's time to queue the work item */
     }
 
     /* It's time to queue the work item */
@@ -480,11 +480,11 @@ RtlpQueueIoWorkerThread(IN OUT PRTLP_WORKITEM WorkItem)
     if (!NT_SUCCESS(Status))
     {
         DPRINT1("Failed to queue APC for work item 0x%p\n", WorkItem->Function);
     if (!NT_SUCCESS(Status))
     {
         DPRINT1("Failed to queue APC for work item 0x%p\n", WorkItem->Function);
-        _InterlockedDecrement(&ThreadPoolIOWorkerThreadsRequests);
+        InterlockedDecrement(&ThreadPoolIOWorkerThreadsRequests);
 
         if (WorkItem->Flags & WT_EXECUTELONGFUNCTION)
         {
 
         if (WorkItem->Flags & WT_EXECUTELONGFUNCTION)
         {
-            _InterlockedDecrement(&ThreadPoolIOWorkerThreadsLongRequests);
+            InterlockedDecrement(&ThreadPoolIOWorkerThreadsLongRequests);
         }
     }
 
         }
     }
 
@@ -543,7 +543,7 @@ RtlpIoWorkerThreadProc(IN PVOID Parameter)
     BOOLEAN Terminate;
     NTSTATUS Status = STATUS_SUCCESS;
 
     BOOLEAN Terminate;
     NTSTATUS Status = STATUS_SUCCESS;
 
-    if (_InterlockedIncrement(&ThreadPoolIOWorkerThreads) > MAX_WORKERTHREADS)
+    if (InterlockedIncrement(&ThreadPoolIOWorkerThreads) > MAX_WORKERTHREADS)
     {
         /* Oops, too many worker threads... */
         goto InitFailed;
     {
         /* Oops, too many worker threads... */
         goto InitFailed;
@@ -562,10 +562,10 @@ RtlpIoWorkerThreadProc(IN PVOID Parameter)
         DPRINT1("Failed to create handle to own thread! Status: 0x%x\n", Status);
 
 InitFailed:
         DPRINT1("Failed to create handle to own thread! Status: 0x%x\n", Status);
 
 InitFailed:
-        _InterlockedDecrement(&ThreadPoolIOWorkerThreads);
+        InterlockedDecrement(&ThreadPoolIOWorkerThreads);
 
         /* Signal initialization completion */
 
         /* Signal initialization completion */
-        _InterlockedExchange((PLONG)Parameter,
+        InterlockedExchange((PLONG)Parameter,
                             1);
 
         RtlExitUserThread(Status);
                             1);
 
         RtlExitUserThread(Status);
@@ -579,7 +579,7 @@ InitFailed:
                    (PLIST_ENTRY)&ThreadInfo.ListEntry);
 
     /* Signal initialization completion */
                    (PLIST_ENTRY)&ThreadInfo.ListEntry);
 
     /* Signal initialization completion */
-    _InterlockedExchange((PLONG)Parameter,
+    InterlockedExchange((PLONG)Parameter,
                          1);
 
     for (;;)
                          1);
 
     for (;;)
@@ -626,7 +626,7 @@ Wait:
             if (Terminate)
             {
                 /* Rundown the thread and unlink it from the list */
             if (Terminate)
             {
                 /* Rundown the thread and unlink it from the list */
-                _InterlockedDecrement(&ThreadPoolIOWorkerThreads);
+                InterlockedDecrement(&ThreadPoolIOWorkerThreads);
                 RemoveEntryList((PLIST_ENTRY)&ThreadInfo.ListEntry);
             }
 
                 RemoveEntryList((PLIST_ENTRY)&ThreadInfo.ListEntry);
             }
 
@@ -663,10 +663,10 @@ RtlpWorkerThreadProc(IN PVOID Parameter)
     PKNORMAL_ROUTINE ApcRoutine;
     NTSTATUS Status = STATUS_SUCCESS;
 
     PKNORMAL_ROUTINE ApcRoutine;
     NTSTATUS Status = STATUS_SUCCESS;
 
-    if (_InterlockedIncrement(&ThreadPoolWorkerThreads) > MAX_WORKERTHREADS)
+    if (InterlockedIncrement(&ThreadPoolWorkerThreads) > MAX_WORKERTHREADS)
     {
         /* Signal initialization completion */
     {
         /* Signal initialization completion */
-        _InterlockedExchange((PLONG)Parameter,
+        InterlockedExchange((PLONG)Parameter,
                              1);
 
         /* Oops, too many worker threads... */
                              1);
 
         /* Oops, too many worker threads... */
@@ -675,7 +675,7 @@ RtlpWorkerThreadProc(IN PVOID Parameter)
     }
 
     /* Signal initialization completion */
     }
 
     /* Signal initialization completion */
-    _InterlockedExchange((PLONG)Parameter,
+    InterlockedExchange((PLONG)Parameter,
                          1);
 
     for (;;)
                          1);
 
     for (;;)
@@ -736,7 +736,7 @@ RtlpWorkerThreadProc(IN PVOID Parameter)
 
             if (Terminate)
             {
 
             if (Terminate)
             {
-                _InterlockedDecrement(&ThreadPoolWorkerThreads);
+                InterlockedDecrement(&ThreadPoolWorkerThreads);
                 Status = STATUS_SUCCESS;
                 break;
             }
                 Status = STATUS_SUCCESS;
                 break;
             }