Search the Community
Showing results for tags 'omnithread'.
Found 3 results
In OTL (3.0.7), OTLCommon.TOmniAffinity.GetMask calls DSiGetSystemAffinityMask, DSiGetProcessAffinityMask and DSiGetThreadAffinityMask which all call Winapi.windows.GetProcessAffinityMask, which can fail (I don't know under what conditions, but clients are reporting that it happens under Wine and also on at least one windows 10 system). If it fails, the var returns lpProcessAffinityMask and lpSystemAffinityMask are undefined. OTL release 1.40 made some changes to support 64 bit, and so I think in most places this behaviour won't show. However, for example OTLCommon.TOmniAffinity.GetCount has affMask := Mask; where affMask is a DWORD and mask is the NativeUInt property. An ERangeError won't be thrown unless: 64 bit arch range checking on GetProcessAffinityMask throws the second 64-bit param (lpProcessAffinityMask) value comes back as an invalid 32 bit value (I assume, under whatever conditions that trigger this issue, winapi doesn't change the stack val, so for example whatever was in that position happened to be an invalid 32 bit value) So my suggestion is that anywhere getProcessAffinityMask is called (I think just 3 places), it is checked for failure and if so some reasonable value is returned, eg if not GetProcessAffinityMask(GetCurrentProcess, Result, systemAffinityMask) then result := 1;
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