Changeset 36 for Comm/CommPort.pas
- Timestamp:
- Aug 4, 2010, 9:15:16 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Comm/CommPort.pas
r2 r36 4 4 { barry@audit.kharkov.com } 5 5 6 // Modified date: 2010-07-29 7 6 8 unit CommPort; 7 9 … … 11 13 Windows, Messages, SysUtils, Classes, Graphics, Controls, 12 14 Forms, Dialogs, ExtCtrls; 15 16 const 17 WaitTime = 10; 13 18 14 19 type … … 470 475 LeaveCriticalSection(FComPort.WriteSection); 471 476 if FComPort.FKillThreads then Break; 472 Sleep( 10);477 Sleep(WaitTime); 473 478 end 474 else Sleep( 10);479 else Sleep(WaitTime); 475 480 until FComPort.FKillThreads or Terminated; 476 481 SetEvent(FComPort.wEvent); … … 509 514 SetEvent(FComPort.rEvent); 510 515 Repeat 511 if WaitForSingleObject(FcomPort.ReadReadyEvent, 500) = WAIT_OBJECT_0 then begin516 if WaitForSingleObject(FcomPort.ReadReadyEvent, WaitTime) = WAIT_OBJECT_0 then begin 512 517 if FComPort.FKillThreads then Break; 513 518 if FComPort.Enabled then … … 595 600 if FcomPort.FKillThreads then Break; 596 601 OK := WaitCommEvent(FComHandle, FStatus, @SOL); 597 if Not OK then Sleep( 10);602 if Not OK then Sleep(WaitTime); 598 603 if FcomPort.FKillThreads then Break; 599 604 if (not OK) and (GetLastError = ERROR_IO_PENDING) then begin … … 725 730 FKillThreads := False; 726 731 StatusThread := TStatusThread.Create(Self, FMonitorEvents); 727 WaitForSingleObject(sEvent, 10);732 WaitForSingleObject(sEvent, WaitTime); 728 733 SetCommMask(FComHandle, EV_BREAK or EV_CTS or EV_DSR or EV_ERR or 729 734 EV_RING or EV_RLSD or EV_RXCHAR or EV_TXEMPTY); 730 735 ReadThread := TReadThread.Create(Self); 731 WaitForSingleObject(rEvent, 10);736 WaitForSingleObject(rEvent, WaitTime); 732 737 WriteThread := TWriteThread.Create(Self); 733 WaitForSingleObject(wEvent, 10);738 WaitForSingleObject(wEvent, WaitTime); 734 739 FOpen := True; 735 740 if Assigned(FOnOpen) then … … 883 888 {Errorflags for OnErrorSignal 884 889 CE_BREAK The hardware detected a break condition. 885 CE_DNS 890 CE_DNS Windows 95 only: A parallel device is not selected. 886 891 CE_FRAME The hardware detected a framing error. 887 CE_IOE 892 CE_IOE An I/O error occurred during communications with the device. 888 893 CE_MODE The requested mode is not supported, or the hFile parameter 889 894 is invalid. If this value is specified, it is the only valid error. 890 CE_OOP 895 CE_OOP Windows 95 only: A parallel device signaled that it is out of paper. 891 896 CE_OVERRUN A character-buffer overrun has occurred. The next character is lost. 892 CE_PTO 897 CE_PTO Windows 95 only: A time-out occurred on a parallel device. 893 898 CE_RXOVER An input buffer overflow has occurred. There is either no 894 899 room in the input buffer, or a character was received after
Note:
See TracChangeset
for help on using the changeset viewer.