omnithreadlibrary

“Emergency” termination of omnithread IOmniParallelTask

…衆ロ難τιáo~ 提交于 2021-02-08 06:52:13
问题 Background I have a unit test in which I check if my handler code code performs well during multi-thread stress: procedure TestAppProgress.TestLoopedAppProgressRelease_SubThread; begin var bt:=Parallel.ParallelTask.NumTasks(1).NoWait.Execute( procedure begin SetWin32ThreadName('TestLoopedAppProgressRelease_SubThread'); RunLoopedAppProgressRelease; end ); lSuccess:=bt.WaitFor(cRunLoopTimerMilliSecs*2); if not lSuccess then bt.Terminate; // emergency termination, unit test failed <<< How do I

“Emergency” termination of omnithread IOmniParallelTask

北战南征 提交于 2021-02-08 06:50:38
问题 Background I have a unit test in which I check if my handler code code performs well during multi-thread stress: procedure TestAppProgress.TestLoopedAppProgressRelease_SubThread; begin var bt:=Parallel.ParallelTask.NumTasks(1).NoWait.Execute( procedure begin SetWin32ThreadName('TestLoopedAppProgressRelease_SubThread'); RunLoopedAppProgressRelease; end ); lSuccess:=bt.WaitFor(cRunLoopTimerMilliSecs*2); if not lSuccess then bt.Terminate; // emergency termination, unit test failed <<< How do I

“Emergency” termination of omnithread IOmniParallelTask

这一生的挚爱 提交于 2021-02-08 06:50:21
问题 Background I have a unit test in which I check if my handler code code performs well during multi-thread stress: procedure TestAppProgress.TestLoopedAppProgressRelease_SubThread; begin var bt:=Parallel.ParallelTask.NumTasks(1).NoWait.Execute( procedure begin SetWin32ThreadName('TestLoopedAppProgressRelease_SubThread'); RunLoopedAppProgressRelease; end ); lSuccess:=bt.WaitFor(cRunLoopTimerMilliSecs*2); if not lSuccess then bt.Terminate; // emergency termination, unit test failed <<< How do I

How can I capture variables by anonymous method when using it in OTL?

二次信任 提交于 2020-03-16 05:22:40
问题 What I want to do: I have a few objects in a genric list. I want to capture each of this object in anonymous method and execute this method as a separate OTL Task. This is a simplified example: program Project51; {$APPTYPE CONSOLE} uses SysUtils, Generics.Collections, OtlTaskControl, OtlTask; type TProc = reference to procedure; type TMyObject = class(TObject) public ID: Integer; constructor Create(AID: Integer); end; constructor TMyObject.Create(AID: Integer); begin ID := AID; end; var

Delphi - OmniThreadLibrary Parallel.ForEach with Records

非 Y 不嫁゛ 提交于 2020-01-25 14:32:32
问题 I am running Delphi XE2 and trying to get familiar with the OmniThreadLibrary, I have 3.03b installed. I have been looking at the Parallel.ForEach examples and am not sure of what's going on in the background (this may well be obvious later - sorry). Any information you can offer to help me better understand how to achieve my goal will be much appreciated. Suppose I have some record that is just a container for 2 related values, a and b. I then want to run a parallel loop that returns an

Delphi - OmniThreadLibrary Parallel.ForEach with Records

回眸只為那壹抹淺笑 提交于 2020-01-25 14:32:15
问题 I am running Delphi XE2 and trying to get familiar with the OmniThreadLibrary, I have 3.03b installed. I have been looking at the Parallel.ForEach examples and am not sure of what's going on in the background (this may well be obvious later - sorry). Any information you can offer to help me better understand how to achieve my goal will be much appreciated. Suppose I have some record that is just a container for 2 related values, a and b. I then want to run a parallel loop that returns an

Why does my application using OmniThreadLibrary Parallel.Pipeline continue remain running in the background after being closed?

谁都会走 提交于 2020-01-06 03:31:07
问题 I'm using OmniThreadLibrary to implement a background pipleline for sending emails (refer to this SO question). I notice that after closing the application, it continues running in the background (seen in Windows Task Manager). That means that there is something wrong in my code in the way I implemented the OTL pipeline. Can you help me identify the trouble? Code follows: unit uEmailQueue; interface uses Classes, OtlCommon, OtlCollections, OtlParallel, Windows; type TEmailServer = record

How to use Pipeline pattern in Delphi

你。 提交于 2019-12-29 08:14:23
问题 I am trying to implement a Pipeline pattern in my test project (How to make a Mutlithreded idhttp calls to do work on a StringList), but am having a struggle adapting TThread code to Pipeline pattern code. There are not many resources about how to use it. I tried my best below, please DO NOT downvote, I know my code is messy but I'll edit my question if needed. type TForm2 = class(TForm) ... private procedure Retriever(const input: TOmniValue; var output: TOmniValue); procedure Inserter(const

Error when using strings in TOmniValue array in a BackgroundWorker

我只是一个虾纸丫 提交于 2019-12-24 03:07:44
问题 When I have a string in a TOmniValue array, then accessing the value by name or by explicit index raises an access violation. See the following code for an example. Am I doing something wrong, or is there an error in Delphi or TOmniValue? I found a workaround for accessing by index, but what about by name? UPDATE: I've moved Test into a console app for easier reproduction, but now the error only occurs in every second run or so instead of every interation. Or maybe it is not even the same

Execution point for other threads in Delphi 2010

ぃ、小莉子 提交于 2019-12-23 13:15:47
问题 I'm developing a multithreaded client app using Delphi 2010 (using the excellent OmniThreadLibrary) and I'm having hard time with debugging since I'm constantly swapping from one thread to another. I wonder if it's possible (using whatever tool or plugin, I don't care!) to find the current execution point, not just for the current thread, but for all the other threads as well. A simplistic example/report: Thread #1 stopped at line #5 Thread #2 stopped at line #25 (<-- breakpoint set here,