Multi-threading mechanisms to run some lengthy operations from winforms code and communication with
Posted
by tmarouda
on Stack Overflow
See other posts from Stack Overflow
or by tmarouda
Published on 2010-03-16T19:07:57Z
Indexed on
2010/03/16
19:11 UTC
Read the original article
Hit count: 528
What do I want to achieve: I want to perform some time consuming operations from my MDI winforms application (C# - .NET).
An MDI child form may create the thread with the operation, which may take long time (from 0.1 seconds, to even half hour) to complete. In the meantime I want the UI to respond to user actions, including manipulation of data in some other MDI child form. When the operation completes, the thread should notify the MDI child that the calculations are done, so that the MDI child can perform the post-processing.
How can I achieve this: Should I use explicit threading (i.e., create explicit threads), thread pools? Or simply just propose your solution. Should I create foreground or background threads?
And how does the thread communicates with the GUI, according the solution you propose?
If you know of a working example that handles a similar situation, please make a note.
© Stack Overflow or respective owner