Questions tagged [omnithreadlibrary]

OmniThreadLibrary is a Delphi library meant to ease threading.

It's written mainly by Primož Gabrijelčič and released under BSD license.

Resources:

124 questions
4
votes
4 answers

OmniThreadLibrary - Code: 1816. Not enough quota is available to process this command

Update 1: I included the stack traces of all threads instead of just the main thread's - I thought it was enough already. Update 2: I reopened this question, since even after applied the changes illustrated in my own question, I still get the very…
Edwin Yip
  • 4,089
  • 4
  • 40
  • 86
4
votes
1 answer

Can TOmniEventMonitor be used in a background thread?

Original Question In our Delphi XE4 application we use a TOmniEventMonitor to receive messages from other tasks. As long as this is running in the main thread, it works fine, but once I put the same code in a task, the TOmniEventMonitor stops…
Tim
  • 375
  • 1
  • 4
  • 18
4
votes
1 answer

Can I use OTL to parallelize nested loops?

I was wondering if I can use OTL to parallelize this loop. I have the following code. for i := 1 to XRes do begin for j := 1 to XRes do begin GridMat.Elem[i,j] := StrToFloat(ListOfValues[(i-1)+((j-1)*Xres)]); end; …
Diego Rueda
  • 2,226
  • 4
  • 21
  • 41
4
votes
2 answers

How to terminate a parallel.foreach from OTL in Delphi xe2

I am learning how to use OmniThreadLibrary in Delphi XE2, i wonder if someone can show me how to cancel a parallel.foreach. I read that I should use a cancellation token, but I cannot find an example of some sort on how to use it. This is the…
Diego Rueda
  • 2,226
  • 4
  • 21
  • 41
4
votes
1 answer

How to monitor Pipeline stages in OmniThreadLibrary?

Is it possible to monitor Pipeline tasks somehow? I tried to add monitors to each task like this FPipeline := Parallel.Pipeline() .Stage(StageWorker1, Parallel.TaskConfig.MonitorWith(MyMonitor)) .NumTasks(MaxReadThreadCount) …
Andrew
  • 3,696
  • 3
  • 40
  • 71
4
votes
2 answers

Why is OmniThreadLibrary limited to 60 threads when .Net's limit is 32768?

I was recently comparing OmniThreadLibrary and ThreadPool that is in .NET and I found that Omni is much more restricted in maximum threads — 60 allowed — while .NET can go up to 32768 in .NET 4.0. Why such a limit?
user1647411
3
votes
1 answer

Omnithread: Create a task wrapper / modify a task that adds some extra pre- and post processing to an alredy existing task

Some background: Basically it comes down to that I want to be able to "execute" the task in the current thread. Why? -I have a task creator routine, and one time I want the task to be executed immediately in a background task, and at other times I…
H.Hasenack
  • 1,094
  • 8
  • 27
3
votes
1 answer

IOmniWorker: Where goes the function to execute within the Task?

I am creating an OmniWorker-Task to do some data processing. So far, the Task is able to receive and send messages from/to other tasks. Now I need to implement the main function for this task. This function will run continuously and do the data…
Holgerwa
  • 3,430
  • 9
  • 42
  • 50
3
votes
2 answers

How to access thread variable using OmniThreadLibrary?

This seems to be an easy task, I just don't know which way to start using OmniThreadLibrary: I create a Task that does some processing in the background. The results are stored in fields of the task class and are continuously filled with new…
Holgerwa
  • 3,430
  • 9
  • 42
  • 50
3
votes
1 answer

Main thread blocking parallel thread?

Create a VCL Forms Application, put a TButton and a TMemo on the Form, and write this code in the button's OnClick handler: uses OtlParallel, OtlTaskControl; procedure TForm2.btnStartLoopClick(Sender: TObject); var starttime: Cardinal; k:…
user1580348
  • 5,721
  • 4
  • 43
  • 105
3
votes
1 answer

Delphi - Omnithreadlibrary, death of main thread in console application

I have a problem with main thread in BackgroundWorker (high level OmniThreadLibrary component) in console application. Object in main thread (whole application) dies as soon as it schedules WorkItems for background tasks. Main thread doesnt wait for…
3
votes
3 answers

Memory Leak using VirtualTreeview and OTL

I had created a small multi threaded application and I am trying to convert it to use OmniThreadLibrary. I am using the Virtualtreeview to display a log and the status/results. The Vst Log only has two columns and the record contains just two string…
Logman
  • 654
  • 1
  • 7
  • 16
3
votes
0 answers

How to trigger TIdHTTP.Disconnect when running in a OmniThreadLibrary task

I am wondering how I may Disconnect an instance of TIdHTTP in Delphi Seattle while it is executed in an anonymous procedure of CreateTask from the OmniThreadLibrary. My current code looks like this: task := CreateTask( procedure(const task:…
Mayam A.
  • 31
  • 3
3
votes
1 answer

Waiting for Invoke to finish when using IOmniTaskControl/TOmniWorker

I've created an IOmniTaskControl using a TOmniWorker, so that I can periodically run chunks of code an a specific thread. So I'll be calling Invoke as needed on this IOmniTaskControl. When I do so, I will sometimes need to wait for the execution…
Larry Fuqua
  • 148
  • 1
  • 5
3
votes
1 answer

Exceptionhandling with IOmniParallelTask not working

Unhandled exceptions within IOmniParallelTask execution should (as I understand the docs) be caught by the OTL and be attached to IOmniTaskControl instance, which may be accessed by the termination handler from IOmniTaskConfig. So after setting up…
codejanovic
  • 522
  • 5
  • 9
1
2
3
8 9