Im Prinzip sieht mein Thread etwa so aus:
Delphi-Quellcode:
procedure TDeviceThread.Execute;
begin
while not Terminated do
begin
case fInQueue.PopItem(LSize, LItem) of
wrSignaled: Begin
// do something more with it (send/receive data)
DoRequest(LItem); // Block till timeout or answer received
fOutQueue.PushItem(LItem);
Queue(DeliverItem);
End;
wrTimeout: Begin
// every 200ms check if some internal handling is needed
end;
end
end;
end;