-
Content Count
246 -
Joined
-
Last visited
-
Days Won
11
Posts posted by Primož Gabrijelčič
-
-
35 minutes ago, Tommi Prami said:ExecuteAndWait will pump messages, whic is 99.999% of work app does... Waiths 7-zip..
-Tee-
ExecuteAndWait processes messages in the worker thread. You have to process messages in the thread that owns the parallel task (in this case the main thread).
- 1
- 1
-
Although, hmmmm, I would expect Parallel.ForEach to work in blocking mode without any message processing. I will look into that as soon as possible.
- 1
-
Messages are still not processed while parallel for is executing.
Run Parallel.ForEach.NoWait.Execute. Process messages while ForEach is running.
-
-
Yes, it fails because the owner (anonymous thread) is destroyed before the worker (Parallel.Async). You could also run into problems because the owner thread is not processing Windows messages, which is a requirement for threads that own OTL tasks. Not in this simple example, but as soon as you start sending messages towards the owner or using OnTerminate handlers you would run into trouble.
-
For starters - why are you running Async from a background thread and not from the main thread?
- 1
-
Official Delphi 12-supporting release: https://github.com/gabr42/OmniThreadLibrary/releases/tag/release-3.07.10
It should also appear in GetIt in a day or two.
- 1
-
Although not officially released, OTL supports Delphi 12. Just download the latest version from the github and you're good to go.
Official release will follow in two weeks.
Primož
- 1
-
I don't know. Show us the code.
-
Use
fController := CreateTask(TWorker.Create()).MsgWait.Run;
Note the extra (). I don't know why, but compiler requires them.
- 1
-
This should work just fine, I wrote a very similar code today and there were no problems:
FWorker := Parallel.BackgroundWorker.NumTasks(1) .Execute( procedure (const workItem: IOmniWorkItem) var result: TTextBoxDetectorResults; begin var data := workItem.Data.ToRecord<TTextBoxDetectorData>; result := FAnalyzer_Asy.Analyze(data); workItem.Result := TOmniValue.FromRecord<TTextBoxDetectorResults>(result); end) .OnRequestDone_Asy( procedure (const Sender: IOmniBackgroundWorker; const workItem: IOmniWorkItem) begin var results := workItem.Result.ToRecord<TTextBoxDetectorResults>; OnAnalyzed_Asy(Self, workItem.UniqueID, results); end)
You will have to put together a reproducible test case.
-
Yes, like that, but use TThread.Queue. There's no need to block the worker thread while memo is being updated.
- 1
- 2
-
13 hours ago, Bill Meyer said:Second, that Amazon freely adjusts the sell price, when and as they wish.
The same goes for Packt. They sell books for $5 (action!) without asking. They even created a monstrosity which combines both my books together and they are selling it separately (again, without asking). But they did manage to make me more money than my self-published OmniThreadLibrary book, even though their commision is much higher than LeanPubs. So they do sell many books.
-
On 2/16/2023 at 10:53 AM, TheOnlyOne said:I have a question about your experience with PacktPub - how was it?
Mixed. They do their job, but you can definitely tell that it is an Indian team behind. Everything is "yes, of course" and then maybe something happens. Or maybe not. Plus they are very set in some formulaic ways - if you want to write a book, it has to fall into some already defined slot for which they know how they want organize it and then they insist on their way (how the content should be structured, what is allowed and what not etc). That is helpful, but also limiting and frustrating.
Most of the time it works the best if you also say "yes, of course" and then do it in your own way. 🙂
Technical staff and editors are mediocre, at best. They definitely will not catch all errors.
So - if you are looking for a perfect partner, they are not the one. If, however, you can just say "eh, whatever" from time to time and move on, they work just fine. They do pay on time, though.
As for the other publishing houses, I have no idea.
- 3
- 2
-
On general, no. In specific cases maybe yes.
- 1
-
Nope, the earliest supported version is 2007.
-
Indeed, I managed to screw that up 😞
Please take a fresh DSiWin32 from https://github.com/gabr42/OmniThreadLibrary/blob/master/src/DSiWin32.pas (just updated). It should fix the problem with D2007.
-
No, I never did any work on CodeLibrarian (as far as I can remember).
-
V3 works with VCL/command line/service.
V4 *will* also support FMX (current development v4 version does not).
- 1
-
I'm only using Delphi tools for threading and synchronization so the end result should work on all supported platforms. I only tested on Ubuntu running on WSL2 though.
-
There is work being done (sporadically) in https://github.com/gabr42/OmniThreadLibrary/tree/v4-develop-2
Current status is: low-level tasks work on Linux, except when they don't and everything locks up hard. (And I have no idea yet why that happens.)
- 1
-
That's an implementation bug in DSiWin32. I'll fix that, thanks for the report.
DSiWin32 should work correctly in Win64. If not, that's a bug.
(Yeah, indeed, naming ...)
- 1
-
By default, an OTL task does not process windows messages (which is requirement for TTimer to work). To enfore windows message processing, call the MsgWait method of your task controller interface before running/scheduling the task. Like this:
task := CreateTask(TWorker.Create()).MsgWait.Run;
Read more here: http://www.omnithreadlibrary.com/book/chap07.html#lowlevel-tomniworker-msgwait
- 1
-
Variant 1: Use a 'procedure' worker (`procedure Worker(const task: IOmniTask)'). Then you can implement your message loop inside.
Variant 2: Use a `TOmniWorker` descendant (as in my example). It will implement its own message loop.
Variant 2a: Override parts of the TOmniWorker message loop (but I actually don't remember anymore how that is done 😠 ).
You can handle most stuff with Variant 2. In addition to timers you can call Task.RegisterWaitObject to connect code to any waitable handle. See demo 31_WaitableObjects for more information. Read more here: http://www.omnithreadlibrary.com/book/chap07.html#lowlevel-iomnitask-registerwaitobject.
- 1
ForEach runs only one "thread" at time
in OmniThreadLibrary
Posted
Use it's .OnStop function (async) or .OnStopInvoke (synchronized to the owner thread).