How can I run tasks without TOmniEventMonitor
? If I start them without it the main thread freezes. Which makes no sense because OmniThreadLibrary
is supposed to be based on TThread
. UnObserved
doesn't really fix this because it just makes an internal copy of the same thing.
type
TWorker = class(TOmniWorker)
function Initialize: Boolean; override;
constructor Create;
end;
begin
var
Task: IOmniTaskControl;
begin
Task := CreateTask(TWorker.Create()).Run; // blocks main thread
Task := CreateTask(TWorker.Create()).UnObserved.Run; // will create internal monitor each time
Task := CreateTask(TWorker.Create()).OnTerminated().Run; // will create internal monitor each time
end.
If I create a TThread
it doesn't need any kind of "Monitors" and it doesn't block the main thread either. I am not sending any kind of messages so why the need for a "Monitor"?