I am wonderin about what could be the best way to connect an worker thread with an UI thread in the way, that the UI thread delegates an assignment to the worker which in case signals that he has finished and hands over the result to the UI thread again - so that the UI can be updated based on those results...
I want to do it only with the native stuff I have (no boost, no not nothin)...
I googled around and couldnt get the right searches up (as it always gave me results where they used CLR/MFC/C# solutions like Begin.Invoke or something like this)...
The possibilities I thought about would contain a queue which would be polled for, or a WM_xxx <- but somehow this does not feel right:/...
How would You do it only with the basic stuff we are given?...
I'm just running through the ways I can think of:
Next up:
PostMessage - the worker thread posts a completion message (to the UI window) - the worker thread can then quit because the PostMessage is non-blocking.
You're question is very general and without more information on the kind of work you want to do it's difficult to be more specific than what's already been suggested.
Having said that, ACE uses workers with queues. You submit a task to the thread's queue and it's processed in turn. That seems like a reasonable basic approach to me.
You've not mentioned how you're prepared to "know" when the work is done (you've already discounted waiting).
My connection is receiving data which shall be submitted to the Dialog I did create... so the worker thread is receiving and the UI thread shall update the UI...
I can signale this via an message or by increasing a semaphore or something like that... Or let the UI-message-function poll for it...
looks like some kind of third party library... What I don´t want to use... but it is interesting to read about it, so i can try to do some stuff on my own (it´s more fun to reinvent the wheel, for me^^)...
If anyony is interested, and for persons who may search for and find this topic: I came up with the idea of APCs (Asynchronous Procedure Calls)... which may fit better to my needs...