gabr42 / gabr42/OmniThreadLibrary

Parallel.For hangs

Open
#57 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Pascal
Stars
513
Forks
147
PR merge metrics
No merged PRs in 30d

Description

The following minimal example compiles and runs fine with Delphi XE5 and OTL 3.04:

```Delphi
program test;
{$APPTYPE CONSOLE}
uses
sysutils, otlparallel;
type
EMyException = class(Exception);
begin
try
Parallel.Join(
procedure
begin
WriteLn('Starting...');
raise EMyException.Create('Error Message');
end,
procedure
begin
WriteLn('Starting...');
raise EMyException.Create('Error Message');
end).Execute;
finally
WriteLn('Done');
end;
end.
```

It outputs, expectedly:

Starting...
Starting...
Done
Exception EJoinException in module test.exe at 00141E1A.
Error Message;
Error Message.

However, the following (equivalent) code hangs:

```Delphi
program test;
{$APPTYPE CONSOLE}
uses
sysutils, otlparallel;
type
EMyException = class(Exception);
begin
try
Parallel.For(0, 1).
Execute(
procedure(i: Integer)
begin
WriteLn('Starting...');
raise EMyException.Create('Error Message');
end);
finally
WriteLn('Done');
end;
end.
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.