El 24/06/2017 a las 0:14, Bo Berglund via Lazarus escribió: The problem is that the debugger always stops on the > exceptions making the debugging impossible (they happen with 10 ms > intervals). When I run into a program that raises a lot of exceptions in a loop, I think that I'm doing something wrong, I have missed some check or data sanitation in the loop. Exceptions are for exceptional cases. I mean, errors or unexpected cases. A case that happens each 10 ms is not an error or an exceptional case, it's one of the usual cases, and it must be handled by the natural flow of the program in a structured way. Raising continuously exceptions is not only an annoyance for debugging, but a performance problem. Exceptions may be expensive.
For example, if you are going to process a file with lines that are integers and alphanumeric strings, and you want to sum only the integers, instead of sum:=0; While not eof(f) do begin readln(f,Line); try num:=StrToInt(Line); sum:=sum+num; except end end; you should use sum:=0; While not eof(f) do begin readln(f,Line); val(num,Line,code); if code=0 then Sum:=Sum+num; end; end; I don't know the FTcpComm component. Isn't there a way to check first if that annoying exception is going to be raised?. Probably there are functions like "IsReadDataReady" and "isSerWriteReady", so you can avoid a lot of exceptions if FTcpComm.IOHandler.IsReadDataReady() then begin FTcpComm.IOHandler.ReadBytes(Buf, BufLen, false); if (Length(Buf) > 0) and isSerWriteReady(FOmH) then begin SerWrite(FComH, Buf[0], Length(Buf)); SetLength(Buf, 0); end; end; Or with several retries in loops with a sleep. -- Saludos Santiago A. -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus