V
vmspro
I need a sanity check and am looking for help. I'm writing a C#
Windows Forms application where when the user clicks a particular
button the event handler for that button executes a rather lengthy
piece of code (it goes off talking to various servers across the
network using TCP sockets). I was planning to eventually implement
this piece of code using a delegate so that I could run it
asynchronously and allow the user to cancel it from the main thread.
Much to my surprise when I run this app (without having implemented any
of the asynch stuff yet) I find that after I click the button and while
it's executing this long piece of code I can click the button again
and it will fire the event handler again and start a second invocation
of this long process. My past experience is that my app and the GUI
would be blocked till the first event handler finished and returned.
I'm guessing that some magic is going on such that while the first
event handler is doing some IO (TCP calls) the main thread is using the
free cycles to check the event queue and process more events but I have
never heard of .NET doing this and am thus confused.
Any enlightenment would be appreciated.
Version is .NET 1.1.
Mark
Windows Forms application where when the user clicks a particular
button the event handler for that button executes a rather lengthy
piece of code (it goes off talking to various servers across the
network using TCP sockets). I was planning to eventually implement
this piece of code using a delegate so that I could run it
asynchronously and allow the user to cancel it from the main thread.
Much to my surprise when I run this app (without having implemented any
of the asynch stuff yet) I find that after I click the button and while
it's executing this long piece of code I can click the button again
and it will fire the event handler again and start a second invocation
of this long process. My past experience is that my app and the GUI
would be blocked till the first event handler finished and returned.
I'm guessing that some magic is going on such that while the first
event handler is doing some IO (TCP calls) the main thread is using the
free cycles to check the event queue and process more events but I have
never heard of .NET doing this and am thus confused.
Any enlightenment would be appreciated.
Version is .NET 1.1.
Mark