Jump to content
dkprojektai

Which rise no problems ?

Recommended Posts

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

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 by dkprojektai

Share this post


Link to post
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

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
Guest

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
Guest

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

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. 

  • Like 1

Share this post


Link to post

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
Guest

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×