dkprojektai 1 Posted September 10, 2019 Hi, because of exceptions I wanted to ask what should I use in task - sleep(3000) or Event.WaitFor(3000)? And is the Application.ProcessMessages needed when I want to get variables? Thanks. Share this post Link to post
dkprojektai 1 Posted September 10, 2019 (edited) Error: Provider: TELDebugInfoMap Location: (00DAF3EF){ANPR_VID.exe } [0666F3EF] OtlParallel.TOmniParallelSimpleLoop.Execute[2]$ActRec.$0$Body (Line 3440, "OtlParallel.pas" + 16) + $0 Unit: OtlParallel Source: OtlParallel.pas Class: TOmniParallelSimpleLoop.Execute[2]$ActRec Routine: $0$Body Line: 3440 Routine offset (bytes): 87 Routine offset (lines): 16 Line offset (bytes): 0 Why it happens? Edited September 10, 2019 by dkprojektai Share this post Link to post
dkprojektai 1 Posted September 10, 2019 Debug info shows not in my code I guess... Share this post Link to post
dkprojektai 1 Posted September 10, 2019 procedure TOmniParallelSimpleLoop.Execute(loopBody: TOmniIteratorSimpleSimpleDelegate); begin InternalExecute( procedure (const task: IOmniTask; taskIndex: integer) var first: integer; last : integer; step : integer; begin first := FPartition[taskIndex].LowBound; last := FPartition[taskIndex].HighBound; step := FStep; if step > 0 then begin if assigned(FCancelWith) then while (first <= last) and (not FCancelWith.IsSignalled) do begin loopBody(first); Inc(first, step); end else while first <= last do begin loopBody(first); <<<<<<<< HERE error rises, How to find where it is in my code? Inc(first, step); end end else begin if assigned(FCancelWith) then while (first >= last) and (not FCancelWith.IsSignalled) do begin loopBody(first); Inc(first, step); end else while first >= last do begin loopBody(first); Inc(first, step); end end; end); end; { TOmniParallelSimpleLoop.Execute } Share this post Link to post
Guest Posted September 10, 2019 Application.ProcessMessages out of MainThread context is the most worst use of Application.ProcessMessages (as it is even bad code when used in MainThread context). Share this post Link to post
dkprojektai 1 Posted September 10, 2019 understood, but where to find the exception point? I understand that it is somewhere in Parallel.For. Or I'm wrong? Share this post Link to post
Guest Posted September 10, 2019 No, not really. The current executed code is an anonymous procedure and was captured by OtlParallel.pas in Line 3440 and in there was an exception Share this post Link to post
dkprojektai 1 Posted September 10, 2019 ok, how to fix it? Or escape it? Prevent? Share this post Link to post
Guest Posted September 10, 2019 I did not see all of your relevant code and you can not tell me where the exception occurs. How can I tell you how to fix it? Remember, I am only a normal human like you. So no magic spells or liquids. Start removing everything that is totally wrong like Application.ProcessMessages called from the wrong context. Share this post Link to post
dkprojektai 1 Posted September 10, 2019 For the moment I've change Parallel.For to TParallel.For (Delphi paralell). Will wait and look is it helps... Share this post Link to post
David Heffernan 2345 Posted September 10, 2019 Don't change libraries and hope. The library you use is known to work well. There's a defect in your code. Work out what it is. Trial and error never works out. Provide a minimal yet complete program ideally a console app. Then you can hope for some help. 1 Share this post Link to post
dkprojektai 1 Posted September 10, 2019 This is an exception in Parallel.for 0052a796 VID_full.exe System.Classes TStrings.LoadFromStream 0052a71f VID_full.exe System.Classes TStrings.LoadFromStream 0052a68f VID_full.exe System.Classes TStrings.LoadFromFile 012eb693 VID_full.exe Unit1 12308 MyFind 012eb8a9 VID_full.exe Unit1 12397 TWorkerThread.Execute$ActRec.$3$Body 011af3f6 VID_full.exe OtlParallel 3440 TOmniParallelSimpleLoop.Execute[2]$ActRec.$0$Body 011aefe2 VID_full.exe OtlParallel 3380 TOmniParallelSimpleLoop.CreateForTask$ActRec.$0$Body 0118a1bb VID_full.exe OtlTaskControl 1991 TOmniTaskExecutor.Asy_Execute 01189219 VID_full.exe OtlTaskControl 1584 TOmniTask.InternalExecute 01188ff2 VID_full.exe OtlTaskControl 1502 TOmniTask.Execute 0117bda2 VID_full.exe OtlThreadPool 889 TOTPWorkerThread.ExecuteWorkItem 0117b92b VID_full.exe OtlThreadPool 846 TOTPWorkerThread.Execute 0040c580 VID_full.exe System 25 ThreadWrapper 004ae119 VID_full.exe madExcept CallThreadProcSafe 004ae17e VID_full.exe madExcept ThreadExceptFrame 752f8541 KERNEL32.DLL BaseThreadInitThunk it rises on this function: // FindInFile: Returns the position where the string to search was found Function MyFind(Key: String): String; var List, LineList: TStringList; I, x: Integer; begin result := ''; List := TStringList.Create; List.LoadFromFile('List_file.txt'); <<<<< HERE try for I := 0 to List.Count - 1 do begin if pos (Key, List.Strings[I]) > 0 then begin result:= List.Strings[I]; break; end; end; finally List.Free; end; end; What I'm doing wrong? Should I pun it into TOmniMREW lock? Share this post Link to post
David Heffernan 2345 Posted September 10, 2019 Provide a minimal complete reproduction. Share this post Link to post
dkprojektai 1 Posted September 10, 2019 I moved function MyFind out of Parallel.for(), now will take a look what's next 🙂 Share this post Link to post
Guest Posted September 12, 2019 On 9/10/2019 at 12:33 PM, Schokohase said: Remember, I am only a normal human like you. I would definitely not put my money on that. https://en.wikipedia.org/wiki/Turing_test Share this post Link to post
Sherlock 663 Posted September 12, 2019 29 minutes ago, Dany Marmur said: I would definitely not put my money on that. https://en.wikipedia.org/wiki/Turing_test Don't worry, a lot of those AIs seem to pass the Turing test, because they are not....AIs, that is. Read here for more: https://ghostwork.info/ Share this post Link to post
Guest Posted September 12, 2019 Since i do not know if you actually are human (see above) i will refrain from adapting your suggestions for the time being. Looks interesting though. Share this post Link to post