do
{
- InitStatus = _InterlockedCompareExchange(&ThreadPoolInitialized,
+ InitStatus = InterlockedCompareExchange(&ThreadPoolInitialized,
2,
0);
if (InitStatus == 0)
Finish:
/* Initialization done */
- _InterlockedExchange(&ThreadPoolInitialized,
+ InterlockedExchange(&ThreadPoolInitialized,
1);
break;
}
}
}
- _SEH_TRY
+ _SEH2_TRY
{
DPRINT("RtlpExecuteWorkItem: Function: 0x%p Context: 0x%p ImpersonationToken: 0x%p\n", WorkItem.Function, WorkItem.Context, WorkItem.TokenHandle);
/* Execute the function */
WorkItem.Function(WorkItem.Context);
}
- _SEH_HANDLE
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- DPRINT1("Exception 0x%x while executing IO work item 0x%p\n", _SEH_GetExceptionCode(), WorkItem.Function);
+ DPRINT1("Exception 0x%x while executing IO work item 0x%p\n", _SEH2_GetExceptionCode(), WorkItem.Function);
}
- _SEH_END;
+ _SEH2_END;
if (Impersonated)
{
}
/* update the requests counter */
- _InterlockedDecrement(&ThreadPoolWorkerThreadsRequests);
+ InterlockedDecrement(&ThreadPoolWorkerThreadsRequests);
if (WorkItem.Flags & WT_EXECUTELONGFUNCTION)
{
- _InterlockedDecrement(&ThreadPoolWorkerThreadsLongRequests);
+ InterlockedDecrement(&ThreadPoolWorkerThreadsLongRequests);
}
}
{
NTSTATUS Status = STATUS_SUCCESS;
- _InterlockedIncrement(&ThreadPoolWorkerThreadsRequests);
+ InterlockedIncrement(&ThreadPoolWorkerThreadsRequests);
if (WorkItem->Flags & WT_EXECUTELONGFUNCTION)
{
- _InterlockedIncrement(&ThreadPoolWorkerThreadsLongRequests);
+ InterlockedIncrement(&ThreadPoolWorkerThreadsLongRequests);
}
if (WorkItem->Flags & WT_EXECUTEINPERSISTENTTHREAD)
if (!NT_SUCCESS(Status))
{
- _InterlockedDecrement(&ThreadPoolWorkerThreadsRequests);
+ InterlockedDecrement(&ThreadPoolWorkerThreadsRequests);
if (WorkItem->Flags & WT_EXECUTELONGFUNCTION)
{
- _InterlockedDecrement(&ThreadPoolWorkerThreadsLongRequests);
+ InterlockedDecrement(&ThreadPoolWorkerThreadsLongRequests);
}
}
}
}
- _SEH_TRY
+ _SEH2_TRY
{
DPRINT("RtlpExecuteIoWorkItem: Function: 0x%p Context: 0x%p ImpersonationToken: 0x%p\n", WorkItem.Function, WorkItem.Context, WorkItem.TokenHandle);
/* Execute the function */
WorkItem.Function(WorkItem.Context);
}
- _SEH_HANDLE
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- DPRINT1("Exception 0x%x while executing IO work item 0x%p\n", _SEH_GetExceptionCode(), WorkItem.Function);
+ DPRINT1("Exception 0x%x while executing IO work item 0x%p\n", _SEH2_GetExceptionCode(), WorkItem.Function);
}
- _SEH_END;
+ _SEH2_END;
if (Impersonated)
{
}
/* update the requests counter */
- _InterlockedDecrement(&ThreadPoolIOWorkerThreadsRequests);
+ InterlockedDecrement(&ThreadPoolIOWorkerThreadsRequests);
if (WorkItem.Flags & WT_EXECUTELONGFUNCTION)
{
- _InterlockedDecrement(&ThreadPoolIOWorkerThreadsLongRequests);
+ InterlockedDecrement(&ThreadPoolIOWorkerThreadsLongRequests);
}
}
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;
- _InterlockedIncrement(&ThreadPoolIOWorkerThreadsLongRequests);
+ InterlockedIncrement(&ThreadPoolIOWorkerThreadsLongRequests);
}
/* It's time to queue the work item */
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)
{
- _InterlockedDecrement(&ThreadPoolIOWorkerThreadsLongRequests);
+ InterlockedDecrement(&ThreadPoolIOWorkerThreadsLongRequests);
}
}
BOOLEAN Terminate;
NTSTATUS Status = STATUS_SUCCESS;
- if (_InterlockedIncrement(&ThreadPoolIOWorkerThreads) > MAX_WORKERTHREADS)
+ if (InterlockedIncrement(&ThreadPoolIOWorkerThreads) > MAX_WORKERTHREADS)
{
/* Oops, too many worker threads... */
goto InitFailed;
DPRINT1("Failed to create handle to own thread! Status: 0x%x\n", Status);
InitFailed:
- _InterlockedDecrement(&ThreadPoolIOWorkerThreads);
+ InterlockedDecrement(&ThreadPoolIOWorkerThreads);
/* Signal initialization completion */
- _InterlockedExchange((PLONG)Parameter,
+ InterlockedExchange((PLONG)Parameter,
1);
RtlExitUserThread(Status);
(PLIST_ENTRY)&ThreadInfo.ListEntry);
/* Signal initialization completion */
- _InterlockedExchange((PLONG)Parameter,
+ InterlockedExchange((PLONG)Parameter,
1);
for (;;)
if (Terminate)
{
/* Rundown the thread and unlink it from the list */
- _InterlockedDecrement(&ThreadPoolIOWorkerThreads);
+ InterlockedDecrement(&ThreadPoolIOWorkerThreads);
RemoveEntryList((PLIST_ENTRY)&ThreadInfo.ListEntry);
}
PKNORMAL_ROUTINE ApcRoutine;
NTSTATUS Status = STATUS_SUCCESS;
- if (_InterlockedIncrement(&ThreadPoolWorkerThreads) > MAX_WORKERTHREADS)
+ if (InterlockedIncrement(&ThreadPoolWorkerThreads) > MAX_WORKERTHREADS)
{
/* Signal initialization completion */
- _InterlockedExchange((PLONG)Parameter,
+ InterlockedExchange((PLONG)Parameter,
1);
/* Oops, too many worker threads... */
}
/* Signal initialization completion */
- _InterlockedExchange((PLONG)Parameter,
+ InterlockedExchange((PLONG)Parameter,
1);
for (;;)
{
TimeoutCount = 0;
- _SEH_TRY
+ _SEH2_TRY
{
/* Call the APC routine */
ApcRoutine(NULL,
(PVOID)IoStatusBlock.Information,
SystemArgument2);
}
- _SEH_HANDLE
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
}
- _SEH_END;
+ _SEH2_END;
}
else
{
if (Terminate)
{
- _InterlockedDecrement(&ThreadPoolWorkerThreads);
+ InterlockedDecrement(&ThreadPoolWorkerThreads);
Status = STATUS_SUCCESS;
break;
}
return Status;
}
+
+/*
+ * @unimplemented
+ */
+NTSTATUS
+NTAPI
+RtlSetIoCompletionCallback(IN HANDLE FileHandle,
+ IN PIO_APC_ROUTINE Callback,
+ IN ULONG Flags)
+{
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+}