PVOID Argument;
SYNC_CALLBACK Early;
SYNC_CALLBACK Late;
- ULONG Sequence;
LONG ProcessorCount;
LONG CompletionCount;
SYNC_PROCESSOR Processor[1];
InterlockedIncrement(&Context->CompletionCount);
for (;;) {
- ULONG Sequence;
-
if (Processor->Exit) {
if (Context->Late != NULL)
Context->Late(Context->Argument, Index);
continue;
}
- Sequence = Context->Sequence;
-
if (Processor->DisableInterrupts) {
ULONG Attempts;
NTSTATUS status;
InterlockedIncrement(&Context->CompletionCount);
Attempts = 0;
- while (Context->Sequence == Sequence &&
- Context->CompletionCount < Context->ProcessorCount) {
+ while (Context->CompletionCount < Context->ProcessorCount) {
_mm_pause();
KeMemoryBarrier();
InterlockedIncrement(&Context->CompletionCount);
- while (Context->Sequence == Sequence &&
- Context->CompletionCount < Context->ProcessorCount) {
+ while (Context->CompletionCount < Context->ProcessorCount) {
_mm_pause();
KeMemoryBarrier();
}
Context->Early = Early;
Context->Late = Late;
- Context->Sequence++;
Context->CompletionCount = 0;
+ KeMemoryBarrier();
Context->ProcessorCount = KeQueryActiveProcessorCountEx(ALL_PROCESSOR_GROUPS);
ASSERT(SyncOwner >= 0);
- Context->Sequence++;
Context->CompletionCount = 0;
+ KeMemoryBarrier();
for (Index = 0; Index < Context->ProcessorCount; Index++) {
PSYNC_PROCESSOR Processor = &Context->Processor[Index];
Irql = KeGetCurrentIrql();
ASSERT3U(Irql, ==, HIGH_LEVEL);
- Context->Sequence++;
Context->CompletionCount = 0;
+ KeMemoryBarrier();
for (Index = 0; Index < Context->ProcessorCount; Index++) {
PSYNC_PROCESSOR Processor = &Context->Processor[Index];
if (Context->Late != NULL)
Context->Late(Context->Argument, SyncOwner);
- Context->Sequence++;
Context->CompletionCount = 0;
+ KeMemoryBarrier();
for (Index = 0; Index < Context->ProcessorCount; Index++) {
PSYNC_PROCESSOR Processor = &Context->Processor[Index];