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. Message Queue and Threads

Message Queue and Threads

Scheduled Pinned Locked Moved C / C++ / MFC
helpdesigndata-structuresquestion
5 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.
  • W Offline
    W Offline
    wilche
    wrote on last edited by
    #1

    Hello Everybody! I need some help in understanding Message Queues when creating an UI thread. I have created a thread that does a lengthy action delivered using SendMessage. Whenever I need the thread to complete this action, a PostThreadMessage is post this request to the thread's message queue. This creates a bottleneck at the queue because more messages are being pumped into the queue then they can be processed! Is there a limit to how many messages that a message queue can hold? Any help with this problem is greatly appreciated! :)

    P B 2 Replies Last reply
    0
    • W wilche

      Hello Everybody! I need some help in understanding Message Queues when creating an UI thread. I have created a thread that does a lengthy action delivered using SendMessage. Whenever I need the thread to complete this action, a PostThreadMessage is post this request to the thread's message queue. This creates a bottleneck at the queue because more messages are being pumped into the queue then they can be processed! Is there a limit to how many messages that a message queue can hold? Any help with this problem is greatly appreciated! :)

      P Offline
      P Offline
      Prem Kumar
      wrote on last edited by
      #2

      Hi, Actually speaking there is no declared limit for the number of messages. But if the same messages are being sent continuously - you could test by using PeekMessage and remove the trailing messages for each message(the specific kind) you are processing.

      W 1 Reply Last reply
      0
      • W wilche

        Hello Everybody! I need some help in understanding Message Queues when creating an UI thread. I have created a thread that does a lengthy action delivered using SendMessage. Whenever I need the thread to complete this action, a PostThreadMessage is post this request to the thread's message queue. This creates a bottleneck at the queue because more messages are being pumped into the queue then they can be processed! Is there a limit to how many messages that a message queue can hold? Any help with this problem is greatly appreciated! :)

        B Offline
        B Offline
        Bill Wilson
        wrote on last edited by
        #3

        There is no practical limit, that I know of. Are you losing messages? How far behind is the worker thread that receives the messages? If the thread spends a significant amount of time waiting, you have extra cycles available. You could try using more that one thread to relieve the bottle neck.

        W 1 Reply Last reply
        0
        • B Bill Wilson

          There is no practical limit, that I know of. Are you losing messages? How far behind is the worker thread that receives the messages? If the thread spends a significant amount of time waiting, you have extra cycles available. You could try using more that one thread to relieve the bottle neck.

          W Offline
          W Offline
          wilche
          wrote on last edited by
          #4

          Thank you for your suggestion, Bill. I will try to look into that. :)

          1 Reply Last reply
          0
          • P Prem Kumar

            Hi, Actually speaking there is no declared limit for the number of messages. But if the same messages are being sent continuously - you could test by using PeekMessage and remove the trailing messages for each message(the specific kind) you are processing.

            W Offline
            W Offline
            wilche
            wrote on last edited by
            #5

            Thank you Prem for your suggestion. The same message is being sent continously and each message is important to be processed. However, I don't quite understand what you mean by the trailing messages. Could you elaborate on that? :)

            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