Asynchronous Mystery
-
I'm having a problem I can't explain. I'm trying to create a generic class that asynchronously loads objects in the background for later use. I'm using C#/VS.NET 2003 and programming for an IPAQ 5500 series. The code is very simple, just a function which loads 3 forms into 3 objects, and releases a mutex after each one is loaded. Then it has 3 properties, one for each object, and in the get accessor it waits on the mutex and returns the object: private workerThreadProc() { mutex1.WaitOne(); mutex2.WaitOne(); mutex3.WaitOne(); frmtest = new frmTesting(); mutex1.ReleaseMutex(); frmload = new frmLoading(); etc. } public frmTesting TestingForm { get { mutex1.WaitOne(); return frmtest; } } Now if i take just that method and run in on a separate thread inside my form, it works. But if I create an instance of this class and the class runs the thread asynchronously in it's constructor, the method starts but then seems to sleep. Any call to the three properties will get to mutex?.WaitOne(); and then hang. Anyone have any idea why this is? It doesn't happen on the desktop, and if I explicitly set the thread priority to Above Normal, it doesn't happen either, but then my form is unresponsive until it's finished and I may as well have loaded them synchronously. Any ideas? Nick