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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Mobile Development
  3. Mobile
  4. Asynchronous Thread Communication in Windows CE Mobile

Asynchronous Thread Communication in Windows CE Mobile

Scheduled Pinned Locked Moved Mobile
csharpdata-structuresjsonquestion
2 Posts 2 Posters 1 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.
  • J Offline
    J Offline
    Jethro63
    wrote on last edited by
    #1

    Greetings: I've been struggling with writting a communications IO thread for a Windows Mobile .NET 2003. I have boiled my concerns down to a couple of basic questions: Is it possible to have one thread send an asynchronous message to another thread. In other words, I'm looking for something equivalent to the "PostMessage" API procedure which places a message into a message queue of a window or command target but does not wait for for the message handler to finish (the way "SendMessage" would). Does this facility exist in Windows Mobile? Can it be implemented in Windows Mobile .NET or must I import things from the CoreLib.DLL? I have also noticed that Windows Mobile .NET does not seem to support waiting on an AutoResetEvent or ManualResetEvent with a timeout. The overrides for "WaitOne" that allow you to provide a timeout parameter don't seem to be there for Windows CE.NET. Ditto on the static function "WaitAll". With these elements removed, I don't know how one goes about writing efficient threads that can sleep when they are not needed and send messages to each othere without having to be "joined at the hip". Have I misunderstood something? I hope I have. If anyone has some insight, I'd appreciate hearing from you. Cheers, Mark

    B 1 Reply Last reply
    0
    • J Jethro63

      Greetings: I've been struggling with writting a communications IO thread for a Windows Mobile .NET 2003. I have boiled my concerns down to a couple of basic questions: Is it possible to have one thread send an asynchronous message to another thread. In other words, I'm looking for something equivalent to the "PostMessage" API procedure which places a message into a message queue of a window or command target but does not wait for for the message handler to finish (the way "SendMessage" would). Does this facility exist in Windows Mobile? Can it be implemented in Windows Mobile .NET or must I import things from the CoreLib.DLL? I have also noticed that Windows Mobile .NET does not seem to support waiting on an AutoResetEvent or ManualResetEvent with a timeout. The overrides for "WaitOne" that allow you to provide a timeout parameter don't seem to be there for Windows CE.NET. Ditto on the static function "WaitAll". With these elements removed, I don't know how one goes about writing efficient threads that can sleep when they are not needed and send messages to each othere without having to be "joined at the hip". Have I misunderstood something? I hope I have. If anyone has some insight, I'd appreciate hearing from you. Cheers, Mark

      B Offline
      B Offline
      Brian R
      wrote on last edited by
      #2

      I recently ran thru the same problem you are describing. After researching other discussions, my solution was to implement a "native" event class using the underlying windows CE API. Next, create a thread-safe message queue (using generics in my solution) that signalled an embedded native event when events were added and reset the event when the queue emptied. I used these pieces to implements a WaitForAny on an array of the native handles. Final result was the desired WaitForAny that you are describing.

      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