djhfwk 0 Posted August 14, 2023 procedure THttpCli.DoRequestSync(Rq : THttpRequest); { V7.04 Timeout added } var TimeOutMsec : UINT; bFlag : Boolean; dwWaitMs : DWORD; AbortRequired : Boolean; { V8.71 JK } AbortMsg : String; { V8.71 JK } begin DoRequestAsync(Rq); if not Assigned(FCtrlSocket.Counter) then FCtrlSocket.CreateCounter; FCtrlSocket.Counter.LastSendTick := IcsGetTickCount64; // Reset counter { V8.71 } if FMultiThreaded then dwWaitMs:= 10 else dwWaitMs:= 1000; TimeOutMsec := FTimeOut * 1000; while FState <> httpReady do begin {$IFDEF MSWINDOWS} if MsgWaitForMultipleObjects(0, Pointer(nil)^, FALSE, dwWaitMs, QS_ALLINPUT) = WAIT_OBJECT_0 then {$ENDIF} MessagePump; { V8.71 JK see if user wants to abandon this request } In multithread mode, i think we can use lower period for MsgWaitForMultipleObjects. Share this post Link to post
FPiette 385 Posted August 14, 2023 You'd better redesign your application using asynchronous functions. Share this post Link to post
Angus Robertson 577 Posted August 14, 2023 You can always override the procedure with your own version omitting the MagWait function completely, as some other ICS units do, see TIcsHttpMulti.DoRequestSync in OverbyteIcsHttpMulti.pas, Angus Share this post Link to post
Fr0sT.Brutal 900 Posted August 21, 2023 Lower than 10 ms? Windows clock has resolution of 10s of msec, lower values are senseless Share this post Link to post