This may be due to a lack of understanding of what is happening under the hood, or simply a lack of understanding of the thread as a whole. When a user logs in, I need to run some tasks that call web services to update data on my system. Since services can take a considerable amount of time, I process the entire process. However, although I think that I am performing a series of tasks in a separate thread other than my application, my application waits until the called function is finished before continuing.
WindowsIdentity identity = WindowsIdentity.GetCurrent();
Manager manager = (Manager)Session["Manager"];
ThreadPool.QueueUserWorkItem(new SafeWaitCallback().Call(identity, delegate(object noCallBack)
{
manager.RunAccountUpdater(identity);
}));
The application freezes until the "RunAccountUpdater" function is complete and a callback occurs. What am I doing wrong / don't understand?
source
share