예제 #1
0
        private void OnAspCompatExecution()
        {
            try {
                if (_syncCaller)
                {
                    // for synchronous caller don't take the app lock (could dead lock because we switched threads)
                    ExecuteAspCompatCode();
                }
                else
                {
                    lock (_app) {
                        ExecuteAspCompatCode();
                    }
                }
            }
            finally {
                // release all STA components
                if (_staComponents != null)
                {
                    foreach (Object component in _staComponents)
                    {
                        Marshal.ReleaseComObject(component);
                    }
                }

                // reschedule execution back to the regular thread pool
                WorkItem.PostInternal(_compCallback);
            }
        }
예제 #2
0
 private void OnAspCompatExecution()
 {
     try
     {
         if (this._syncCaller)
         {
             this.ExecuteAspCompatCode();
         }
         else
         {
             lock (this._app)
             {
                 this.ExecuteAspCompatCode();
             }
         }
     }
     finally
     {
         System.Web.UnsafeNativeMethods.AspCompatOnPageEnd();
         if (this._staComponents != null)
         {
             foreach (object obj2 in this._staComponents)
             {
                 if (!this.IsStaComponentInSessionState(obj2))
                 {
                     Marshal.ReleaseComObject(obj2);
                 }
             }
         }
         this._ar.SetComplete();
         WorkItem.PostInternal(this._compCallback);
     }
 }
예제 #3
0
        private void OnAspCompatExecution()
        {
            try {
                if (_syncCaller)
                {
                    // for synchronous caller don't take the app lock (could dead lock because we switched threads)
                    ExecuteAspCompatCode();
                }
                else
                {
                    lock (_app) {
                        ExecuteAspCompatCode();
                    }
                }
            }
            finally {
                // call PageEnd
                UnsafeNativeMethods.AspCompatOnPageEnd();

                // release all STA components not in session
                if (_staComponents != null)
                {
                    foreach (Object component in _staComponents)
                    {
                        if (!IsStaComponentInSessionState(component))
                        {
                            Marshal.ReleaseComObject(component);
                        }
                    }
                }

                // notify any code polling for completion before QueueUserWorkItem to avoid deadlocks
                // (the completion work item could be help up by the threads doing polling)
                _ar.SetComplete();

                // reschedule execution back to the regular thread pool
                WorkItem.PostInternal(_compCallback);
            }
        }