fpSleep lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- skiy1337lazarus · 2015-08-23 11:23 Ever find yourself wanting to delay for one second on OS X? fpSystem('sleep 1'); This is because fpSleep is missing lol. ---------------------------------------------------------------------- rvk · 2015-08-23 11:29 O wow, there are a lot of TODOs in /fpc/rtl/macos/sysutils.pp. You might want to try fpSelect(). Code: [Select]{ wait a while } fpSelect(0, nil, nil, nil, secs * 1000); (or does fpSelect() also not work in MacOS?) ---------------------------------------------------------------------- Cyrax · 2015-08-23 13:28 Why you want to use fpSleep? Isn't Sleep procedure from SysUtils unit not enough for you? http://www.freepascal.org/docs- html/rtl/sysutils/sleep.html ---------------------------------------------------------------------- rvk · 2015-08-23 13:42 Quote from: Cyrax on August 23, 2015, 03:28:57 pmWhy you want to use fpSleep? Isn't Sleep procedure from SysUtils unit not enough for you? http://www.freepascal.org/docs-html/rtl/sysutils/sleep.html Did you look at the implementation of Sleep() in /fpc/rtl/macos/sysutils.pp? (Isn't that the SysUtils implementation of MacOS ??) Code: [Select]//{$DEFINE HAS_SLEEP}     TODO procedure Sleep(milliseconds: Cardinal); begin end; Yeah, that will really work ---------------------------------------------------------------------- Cyrax · 2015-08-23 13:49 It is indeed empty in macos (isn't this for old MacOS versions, pre X?) directory. You might want to check out darwin and unix directories. These directories are supposed to be the correct ones for MacOS X. And it is defined in unix/sysutils.pp as this:Code: [Select]procedure Sleep(milliseconds: Cardinal); Var   timeout,timeoutresult : TTimespec;   res: cint; begin   timeout.tv_sec:=milliseconds div 1000;   timeout.tv_nsec:=1000*1000*(milliseconds mod 1000);   repeat     res:=fpnanosleep(@timeout,@timeoutresult);     timeout:=timeoutresult;   until (res<>-1) or (fpgeterrno<>ESysEINTR); end;