internal static int ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, int flags) { IIS7WorkerRequest wr = null; HttpContext context = null; RequestNotificationStatus notificationStatus = RequestNotificationStatus.Continue; if (managedHttpContext == IntPtr.Zero) { InitializeRequestContext(nativeRequestContext, flags, out wr, out context); if (context == null) { return(2); } context.Root(); UnsafeIISMethods.MgdSetManagedHttpContext(nativeRequestContext, context.ContextPtr); HttpRuntime.IncrementActivePipelineCount(); } else { context = UnwrapContext(managedHttpContext); wr = context.WorkerRequest as IIS7WorkerRequest; } if ((context.InIndicateCompletion && (context.CurrentThread != Thread.CurrentThread)) && (0x20000000 != UnsafeIISMethods.MgdGetCurrentNotification(nativeRequestContext))) { while (context.InIndicateCompletion) { Thread.Sleep(10); } } NotificationContext notificationContext = context.NotificationContext; bool locked = false; try { bool isReEntry = notificationContext != null; if (isReEntry) { context.ApplicationInstance.AcquireNotifcationContextLock(ref locked); } context.NotificationContext = new NotificationContext(flags, isReEntry); notificationStatus = HttpRuntime.ProcessRequestNotification(wr, context); } finally { if (notificationStatus != RequestNotificationStatus.Pending) { context.NotificationContext = notificationContext; } if (locked) { context.ApplicationInstance.ReleaseNotifcationContextLock(); } } if (notificationStatus != RequestNotificationStatus.Pending) { HttpApplication.ThreadContext indicateCompletionContext = context.IndicateCompletionContext; if (!context.InIndicateCompletion && (indicateCompletionContext != null)) { if (notificationStatus == RequestNotificationStatus.Continue) { try { context.InIndicateCompletion = true; Interlocked.Increment(ref _inIndicateCompletionCount); UnsafeIISMethods.MgdIndicateCompletion(nativeRequestContext, ref notificationStatus); goto Label_01C2; } finally { Interlocked.Decrement(ref _inIndicateCompletionCount); if (!indicateCompletionContext.HasLeaveBeenCalled) { lock (indicateCompletionContext) { if (!indicateCompletionContext.HasLeaveBeenCalled) { indicateCompletionContext.Leave(); context.IndicateCompletionContext = null; context.InIndicateCompletion = false; } } } } } if (!indicateCompletionContext.HasLeaveBeenCalled) { lock (indicateCompletionContext) { if (!indicateCompletionContext.HasLeaveBeenCalled) { indicateCompletionContext.Leave(); context.IndicateCompletionContext = null; context.InIndicateCompletion = false; } } } } } Label_01C2: return((int)notificationStatus); }