hello,
i have played with my prolific USB-COM and sertest on debug and i have found where there is a problem :
it is in the DeviceClose procedure :
procedure TLazSerial.DeviceClose;
begin
// flush device
if FSynSer.Handle<>INVALID_HANDLE_VALUE then begin
FSynSer.Flush;
FSynSer.CloseSocket;
// FSynSer.Purge;
end;
// stop capture thread
if ReadThread<>nil then begin
ReadThread.FreeOnTerminate:=false;
ReadThread.MustDie:= true;
while not ReadThread.Terminated do begin
Application.ProcessMessages;
end;
ReadThread.Free;
ReadThread:=nil;
end;
with no breakpoint if i open the serial port and close the port , closing the port i don't reach ReadThread.Free : seems to be stayed in the ReadThread.Terminated loop.
if i put a breakpoint at the beginning of the procedure (line if FSynSer.Handle) no problem running after the program . I reach the end of the procedure.
I have tried to put a delay at the beginning of the procedure with no success.
I don't understand why the breakpoint solve the problem.
friendly, J.P