Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mdi app with multiple GUI threads

C# MDI application with separate GUI threads for each child in MDI is that possible ?

For example if one of the child forms is blocked by some synchronous request it freezes the entire container ( MDI Parent ) and the other windows open also become in accessible.

In general , is it possible to have more than one GUI thread in .net windows form app domain ?

In visual studio default winform application has STA ( single threaded apartment ) setup. In theory I understand what MTA means here but what is the practical use of it.

In my use case the individual mdi child are developed by various teams who may not defer blocking calls in an async manner , so I am just wondering if its possible to have multiple UI threads , although its not advisable - I completely agree.

edit #1:

I can think of google chrome browser as an example where individual tab is a separate process probably with a dedicated GUI thread ? Is something like this possible in a dot.net app.

like image 836
dotnetcoder Avatar asked Mar 21 '26 22:03

dotnetcoder


1 Answers

Rather than trying to force multiple threads into the GUI layer, make the GUI layer defer all its work to a background thread. That way if some background thread becomes unresponsive the whole GUI including the MDI child that is reflecting the unresponsive background thread is responsive.

like image 80
fryguybob Avatar answered Mar 23 '26 12:03

fryguybob



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!