I noticed something while testing some of my code on a Windows XP 32-bit virtual machine: My application always kept hanging. I never had such phenomenon on my Windows 7 64-bit computer but it was 100% reproducible on the VM.
Via remote debugging i found out that the program was hanging on a call of IOmniTaskControl.WaitForInit
. I set a breakpoint in TOmniWorker.Initialize
but it was not triggered.
This is the method where I create the task:
constructor TThreadedImportCache.Create(
const AImportCacheConstructorParams: TImportCacheConstructorParamsWrapper);
begin
inherited Create;
FIsFlushingCounter := CreateCounter;
FWorker := TImportCacheWorker.Create(AImportCacheConstructorParams, FIsFlushingCounter);
FTaskControl := CreateTask(FWorker, BuildUniqueIdent(TImportCacheWorker.ClassName));
FTaskControl.Unobserved;
FTaskControl.Schedule;
end;
When I replace FTaskControl.Schedule
with FTaskControl.Run
the task is initialized, runs fine and my application does not freeze.
My question(s):
Have I been misusing the
Schedule
call? I thought it was the one to use, as it's not waiting to be actually run and the task is started some short time later. How is it supposed to be used?or
Is this some problem/incompatibility concerning threading (via OmniThreadLibrary) on Windows XP?