You are not logged in.
Pages: 1
Hello, I don't understand at all how to use mormot.core.threads. Could you give some examples, for example, how to parallelize Tstringlist ?
I can't find any information on how to use mormot.core.threads anywhere, but I'd like to try it.
Offline
I don't understand what "parallelize TStringList" mean.
TStringList is not thread safe by itself.What do you want to do?
Hi, I mean, for example, something like this, as it is done in another library, OmniThreadLibrary:
var
StringList:Tstringlist;
....
Parallel.ForEach(0, Stringlist.count-1).NumTasks(4).Execute(
procedure (const i: integer)
begin
...
Stringlist[i];
....
end);I would like to do something similar through mormot.core.threads
Offline
Key Differences from OmniThreadLibrary
| Aspect | OmniThreadLibrary | mORMot |
|--------------------|-----------------------|-------------------------------------------|
| Callback signature | procedure(i: integer) | procedure(IndexStart, IndexStop: integer) |
| Granularity | Per-item | Per-range (more efficient) |
| Thread pool | Implicit | Explicit TSynParallelProcess |
| Anonymous methods | Supported | Requires method of object |Full runnable demo is here: https://gist.github.com/zen010101/a69f7 … 41da1424b7
Offline
Pages: 1