Asynchronous Agents and Window Messages

I am currently playing with a library of asynchronous agents in Microsoft Concurrency Runtime . I have not yet found an obvious way to notify about the completion of a task using window messages or some other ways to notify the user interface thread that the work is completed.

I know that I can pass window and message handlers ( WM_xxx) along with tasks and use the task PostMessage()to transfer the user interface stream. This, in my opinion, is somewhat ugly and the source of the error. If an exception occurs, I should have a catch handler that signals my UI thread. This is easily forgotten, and the exclusion condition may not be met very often, so it is difficult to detect.

The documentation talks about how to transfer data back to the user interface stream. It does not use window messages, but polling methods. I find it silly to set up timers for polling if the task is completed when interrupt methods are available!

It is strange that it is not built into the library, since it is not a cross platform. It is designed to work on Windows and Windows only from what I understand.

Is the functionality available in the library, or do I need to manually flip it?

+5
source share
1 answer

You can create one monitor stream with a single monitoring function, unbounded_buffer, for a Windows message and send the message accordingly. Tell your agents about this buffer.

+1
source

All Articles