Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Mobile
  4. Asynchronous Mystery

Asynchronous Mystery

Scheduled Pinned Locked Moved Mobile
csharpvisual-studiohelpquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DiscoJimmy
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups