gabr42 / gabr42/OmniThreadLibrary

AV Thrown using a ThreadPool Task

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

Description

Using Thread pool with Monitor in 64 bit environment throws ACCES
[thread_pool_test.zip](https://github.com/gabr42/OmniThreadLibrary/files/100010/thread_pool_test.zip)
S_VIOLATION exception.

Here is a piece of code I’ve for re-creating an issue.

if cbThreadPool.Checked then
begin

```
// create thread pool
FThreadPool := CreateThreadPool('Test thread pool')
.MonitorWith(OmniEventMonitor);

// create task
task := CreateTask(TTestWorker.Create(Handle), 'Test task')
.MonitorWith(OmniEventMonitor)
.Schedule(FThreadPool);
```

end
else
begin

```
// create task
task := CreateTask(TTestWorker.Create(Handle), 'Test task')
.MonitorWith(OmniEventMonitor)
.Run;
```

end;
I am submitting a report on behalf of a developer on my team:
1. Then task created and executed by using Thread Pool, it immediately throws ACCESS_VIOLATION exception in the line
pool := emMonitoredPools.ValueOf(tpMonitorInfo.UniqueID) as IOmniThreadPool;
in procedure TOmniEventMonitor.WndProc(var msg: TMessage);
Call Stack goes all the way to Application.ProcessMessage.
2. Then task created and executed – no issues at all.

In 32 bit environment both cases works fine.

Test environment:
Delphi 10 Seattle
Omni Thread Library – 3.05. Actually can’t say for sure. History.txt looks like misses label for latest version.

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.