OmniThreadLibrary
OmniThreadLibrary copied to clipboard
CreateTask in Task group with Unobserved function call fails
Reported by Saskathex, Nov 11, 2014
Following code produces on certain machines an error. The error happens sometimes but not all the times.
TaskGroup := CreateTaskGroup;
try
for I := 0 to 2 do
CreateTask (TestTask, Format ('TestTask %d', [I]))
.SetParameter ('Number', I)
.Unbserved
.Join (TaskGroup);
TaskGroup.RunAll;
Starting the tasks inside the Task Group Fails with the following stack trace:
OtlEventMonitor:221 (OtlEventMonitor.TOmniEventMonitor.Destroy) Access violation at address 0000000002060A36 in module 'ABC.exe'. Read of address 0000000000000000
[0000000002060A36] OtlEventMonitor.TOmniEventMonitor.Destroy (Line 221, "OtlEventMonitor.pas")
[0000000076D21278] KiUserExceptionDispatcher
[0000000002060A36] OtlEventMonitor.TOmniEventMonitor.Destroy (Line 221, "OtlEventMonitor.pas")
[000000000205E2DF] OtlTaskControl.TOmniTaskControlEventMonitor.Create (Line 3348, "OtlTaskControl.pas")
[0000000002061BE6] OtlEventMonitor.TOmniEventMonitorPool.Allocate (Line 414, "OtlEventMonitor.pas")
[000000000205E55D] OtlTaskControl.TOmniTaskControlEventMonitorPool.Allocate (Line 3379, "OtlTaskControl.pas")
[000000000205A114] OtlTaskControl.TOmniTaskControl.CreateInternalMonitor (Line 2491, "OtlTaskControl.pas")
[000000000205CD54] OtlTaskControl.TOmniTaskControl.Unobserved (Line 3045, "OtlTaskControl.pas")
Using Version 3.03b on an Windows Server 2008R2 64bit.
Removing the Unobserved function call works for us!