Thread: event handling is serialized in MS Visual Studio C++ 2005 ??

  1. #1
    Alessio Stella
    Join Date
    May 2008
    Location
    Italy, Bologna
    Posts
    251

    event handling is serialized in MS Visual Studio C++ 2005 ??

    In Microsoft Visual Studio C++ 2005 let's suppose I have three events raised one just after the other (before the first event has finished being handled) for instance:
    (1) button 1 click
    (2) 100msec Windows Form Timer elapsed
    (3) button 2 click

    What will happen?
    (1) Button 1 click handling is executed. Timer1 handling is executed. Button2 is eexcuted
    or
    (2) button 1 handling is interrupted by Timer1 handling?

    Another similar question:
    What if Timer1 elapses every 100 msec but its handler takes around 110 msec to be executed?
    (1) the queue of event handling raises up and at a certain point I have a system error?
    (2) the queue of event handling raises up and at a certain point I have discarding of events?
    (3) each handling interrupts the execution of previous not finished handling?

    Thank you

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    The message handling is sequential. The timer itself will issue the message when the timer fires, but the message (event) handling will, unless you specifically work around it, handle the events one at a time, in the order they came in. And if you have a repeating timer, then you may find that you have more than one timer message in the message (event) queue.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Quote Originally Posted by matsp View Post
    The message handling is sequential. The timer itself will issue the message when the timer fires, but the message (event) handling will, unless you specifically work around it, handle the events one at a time, in the order they came in. And if you have a repeating timer, then you may find that you have more than one timer message in the message (event) queue.

    --
    Mats
    In addition - WM_TIMER event has a lowest priority, so other events could be inserted into the event queue before the timer event was processed delaying the TIMER processing (that was already scheduled, but not dispached yet)
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  4. #4
    Alessio Stella
    Join Date
    May 2008
    Location
    Italy, Bologna
    Posts
    251
    Quote Originally Posted by vart View Post
    In addition - WM_TIMER event has a lowest priority, so other events could be inserted into the event queue before the timer event was processed delaying the TIMER processing (that was already scheduled, but not dispached yet)

    Thank you
    Could you suggest a link, an help page or something else where I can study in detail this subject?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 04:09 AM
  2. Console Font Size
    By bradszy in forum Windows Programming
    Replies: 34
    Last Post: 04-26-2008, 07:09 AM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  4. using classes
    By krazykrisi in forum C++ Programming
    Replies: 9
    Last Post: 11-22-2006, 10:41 AM
  5. MS Visual C++ 6 wont include vector.h in a header file
    By bardsley99 in forum C++ Programming
    Replies: 9
    Last Post: 11-06-2003, 12:05 PM