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. GetQueueStatus

GetQueueStatus

Scheduled Pinned Locked Moved C / C++ / MFC
questiondesigndata-structures
7 Posts 2 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.
  • A Offline
    A Offline
    Alex_Y
    wrote on last edited by
    #1

    How can I get status of the queue from another thread? I have one worker thread A and UI thread B. Now I need in A find status of message queue of B. Thanks. :)

    D 1 Reply Last reply
    0
    • A Alex_Y

      How can I get status of the queue from another thread? I have one worker thread A and UI thread B. Now I need in A find status of message queue of B. Thanks. :)

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Ideally, thread A should post a message to thread B asking about it's queue status. Thread B should then respond by posting a message back to thread A with the status. Make sense?


      "One must learn from the bite of the fire to leave it alone." - Native American Proverb

      A 1 Reply Last reply
      0
      • D David Crow

        Ideally, thread A should post a message to thread B asking about it's queue status. Thread B should then respond by posting a message back to thread A with the status. Make sense?


        "One must learn from the bite of the fire to leave it alone." - Native American Proverb

        A Offline
        A Offline
        Alex_Y
        wrote on last edited by
        #3

        If B freeze or busy I will overwhelm its queue which could at that moment already full. I am trying to minimize any message exchange. David BTW do you know how exception mechanizm colapsing/destroing stack up to the first catch? I think it could help me to solve problem. Thanks. :)

        D 1 Reply Last reply
        0
        • A Alex_Y

          If B freeze or busy I will overwhelm its queue which could at that moment already full. I am trying to minimize any message exchange. David BTW do you know how exception mechanizm colapsing/destroing stack up to the first catch? I think it could help me to solve problem. Thanks. :)

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Alex_Y wrote: If B freeze or busy I will overwhelm its queue which could at that moment already full. While message queues do have an upper limit (10,000 per MSDN), I've never heard of one being filled up, unless it had underlying problems. In any case, PostMessage() will return FALSE if the queue is indeed full.


          "One must learn from the bite of the fire to leave it alone." - Native American Proverb

          A 1 Reply Last reply
          0
          • D David Crow

            Alex_Y wrote: If B freeze or busy I will overwhelm its queue which could at that moment already full. While message queues do have an upper limit (10,000 per MSDN), I've never heard of one being filled up, unless it had underlying problems. In any case, PostMessage() will return FALSE if the queue is indeed full.


            "One must learn from the bite of the fire to leave it alone." - Native American Proverb

            A Offline
            A Offline
            Alex_Y
            wrote on last edited by
            #5

            :) I know for sure that there is underlying problem. I want do the work around because one of the ocx controls in UI thread freezing. I already subclass windproc, but I never know on what message third party control will freez. Messages which is comming from message loop is "peace of cake". I can skip them if I already know from subclassing that control is busy, but most hassel is Send messages which is comming from parent/Windows which goes directly to the WindProc. I never know how log that particular message will spend in ocx control. I find that send/post message don't improves situation if control already stuck. Even if you send WM_NULL just to make sure that message loop in still alive. Thanks. P.S. Sometimes sharing with somebody is giving feeleng that you solve half of problem. :) :)

            D 1 Reply Last reply
            0
            • A Alex_Y

              :) I know for sure that there is underlying problem. I want do the work around because one of the ocx controls in UI thread freezing. I already subclass windproc, but I never know on what message third party control will freez. Messages which is comming from message loop is "peace of cake". I can skip them if I already know from subclassing that control is busy, but most hassel is Send messages which is comming from parent/Windows which goes directly to the WindProc. I never know how log that particular message will spend in ocx control. I find that send/post message don't improves situation if control already stuck. Even if you send WM_NULL just to make sure that message loop in still alive. Thanks. P.S. Sometimes sharing with somebody is giving feeleng that you solve half of problem. :) :)

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              Is SendMessageTimeout() of any help?


              "One must learn from the bite of the fire to leave it alone." - Native American Proverb

              A 1 Reply Last reply
              0
              • D David Crow

                Is SendMessageTimeout() of any help?


                "One must learn from the bite of the fire to leave it alone." - Native American Proverb

                A Offline
                A Offline
                Alex_Y
                wrote on last edited by
                #7

                I was trying to resend to myself message by SendMessageTimeOut and it never expired. I found on msdn that timeout is disabled if you doing within the same thread. :) Remarks The function calls the window procedure for the specified window and, if the specified window belongs to a different thread, does not return until the window procedure has processed the message or the specified time-out period has elapsed. !!! If the window receiving the message belongs to the same queue as the current thread, the window procedure is called directly—the time-out value is ignored. !!! Thanks. :)

                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