Threads executing event loop just like in the Qt framework #60474
Replies: 4 comments 5 replies
-
Are you looking for some kind of language feature for this? If so, what would something like that look like? This seems like more a question for the Runtime repository that deals with the base APIs. |
Beta Was this translation helpful? Give feedback.
-
Thank you all for all these useful informations. With my colleagues, we will look at the informations you shared with me (channels look promising) and try to see what can be useful for our use cases (serialize requests in a thread, etc...) |
Beta Was this translation helpful? Give feedback.
-
Is there a .NET documentation like this : https://doc.qt.io/qt-5/threads-technologies.html to advise C# developers o, the available threading techniques within C# ? |
Beta Was this translation helpful? Give feedback.
-
I made this example that may be of interest to some https://github.com/embeddedmz/message_passing_on_csharp |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
With MS technologies, there's only the GUI thread that has this capability. In other words, I want to have a thread that runs an "event loop" (or a pump message in other terms) as its main function and offer to the user methods like Invoke and BeginInvoke (like the methods that can be called on a WPF dispatcher).
I know that it can be made with a BlockingCollection and other threads can use a lambda to package a method and its arguments but it would be cool to have something operational right out of the box (and that we can use to get back the result, the return of the method, from the receiver thread). It reminds me of Unix processes that communicate with each other via message queues, I think this is safer than a program containing a spaghetti of threads using locks (managed by the user), I think that the first case is more structured and robust.
Some resources :
https://doc.qt.io/qt-5/threads-qobject.html
https://stackoverflow.com/questions/67418826/possibility-of-converting-a-c-qt-threads-using-event-loops-to-c-sharp-or-java
https://stackoverflow.com/questions/41271071/how-to-queue-up-delegates-to-be-executed-in-series-in-the-background-with-c
Best regards.
Beta Was this translation helpful? Give feedback.
All reactions