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. General Programming
  3. C / C++ / MFC
  4. Synchronization - Wait Functions

Synchronization - Wait Functions

Scheduled Pinned Locked Moved C / C++ / MFC
comhelpquestion
4 Posts 3 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.
  • S Offline
    S Offline
    SNathani
    wrote on last edited by
    #1

    I'm creating a ocx in VC which is used for a custom protocol. The main handshaking and connecting to remote host etc., will be handled by a VB app. I only have to read the COM port through my local buffer variable which is set by VB app in OnComm event. If my input buffer is empty, I need to wait till I get something in my buffer? Can someone pls. help me how I can do that wihtout jamming the application. Thanks in advance,

    B 1 Reply Last reply
    0
    • S SNathani

      I'm creating a ocx in VC which is used for a custom protocol. The main handshaking and connecting to remote host etc., will be handled by a VB app. I only have to read the COM port through my local buffer variable which is set by VB app in OnComm event. If my input buffer is empty, I need to wait till I get something in my buffer? Can someone pls. help me how I can do that wihtout jamming the application. Thanks in advance,

      B Offline
      B Offline
      Branislav
      wrote on last edited by
      #2

      Simple example is using thread function which wait to fill the buffer and after it send some flag to your application (Get/Set or Fire - are your choice).

      B S 2 Replies Last reply
      0
      • B Branislav

        Simple example is using thread function which wait to fill the buffer and after it send some flag to your application (Get/Set or Fire - are your choice).

        B Offline
        B Offline
        basementman
        wrote on last edited by
        #3

        Or, you could use overlapped I/O on the read, triggering a callback function when the read actually occurs (or posting to an I/O Completion Port).

        1 Reply Last reply
        0
        • B Branislav

          Simple example is using thread function which wait to fill the buffer and after it send some flag to your application (Get/Set or Fire - are your choice).

          S Offline
          S Offline
          SNathani
          wrote on last edited by
          #4

          Hi, I tried that with WaitForSingleObject(), but it hangs up the whole thread for certain time and gives timeout messages. As far as I know, Visual Basic run all components in single thread, correct me if I'm wrong. I can't use callback functions, as this code model doesn't integrate with the existing system, which uses some other protocols. For your clarification - I'm working on ZModem, developing VC++ OCX which will be used in VB and Powerbuilder applications.

          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