Search the Community
Showing results for tags 'omnithread'.
Found 2 results
Fulgan posted a topic in OmniThreadLibraryHello, I have an issue with the TOmniContainerWindowsMessageObserver and observers in general. I use one instance of TOmniMessageQueue to send data from a background thread to the main thread. However, it happens that several window are interested in receiving messages from the queue. So, I setup things like this: each form will create a TOmniContainerWindowsMessageObserver observer and attach it to the TOmniMessageQueue like this during the form's show event: MQObserver := CreateContainerWindowsMessageObserver(handle, WM_NEW_ITEM, 0, 0); // Create an observer that will notify the main form when new messages are received UserMessageQueue.ContainerSubject.Attach(MQObserver, coiNotifyOnAllInserts); // attach the observer to the message queue Likewise, when the form closes, the observer is detached and destroyed: UserMessageQueue.ContainerSubject.Detach(MQObserver, coiNotifyOnAllInserts); // we don't need the observer anymore FreeAndNil(MQObserver); My problem is that as soon as one observer is detached from the queue, all other observer stops notifying the other windows of the fact that a new message has been inserted. What am I missing here?
OK, I was trying to ask how to rewrite a Application that I create using thread to be more responsive, then I found this video: OmniThread Library - Primoz Gabrijelcic Thursday, September 3, 2015 What I need starts at Async/Await demo (t=300) So I'll leave the link, I will see it, read and practice to see if I can re write my application. Regards