Forum > Other

unblocked Sleep() for all Platforms

(1/4) > >>

In Windows i do use this ->

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure Sleep(const AMilliSeconds: DWORD);var  Ret: DWORD;  WaitTime: Int64;  Timer: THandle;begin  Timer := CreateWaitableTimer(nil, TRUE, nil);  WaitTime := Round((AMilliSeconds / 1000) * -10000000);  SetWaitableTimer(Timer, WaitTime, 0, nil, nil, FALSE);  repeat    Ret := MsgWaitForMultipleObjects(1, Timer, FALSE, INFINITE, QS_ALLINPUT);    if (Ret <> (WAIT_OBJECT_0+1)) then      Break;    Application.ProcessMessages;  until False;  if (Ret <> WAIT_OBJECT_0) then    CancelWaitableTimer(Timer);  CloseHandle(Timer);end; to temporarily suspend the workflow without that my application freeze or i do waste CPU.

Since i do use pure Windows Api calls to achieve that, how can i do the same for other OS's?

(I am sorry if i did posted in wrong sub-forum, please move this topic wherever it should be)

Maybe FPC/Lazarus has already something similar included?



--- Quote from: Red_prig on August 27, 2022, 04:12:15 pm ---

--- End quote ---

That is blocking. I do need unblocked version. (Application shall not freeze)

There are definitely none

In principle you can use maybe this will work for you


[0] Message Index

[#] Next page

Go to full version