Backport some fixes to sys_domicrosleep from vanilla.

Massaged the routine a bit to bring it more in line with what vanilla
currently has, and backported some recent changes in rev. 1f383be3 and
rev. ff9e52c6 from vanilla which are supposed to fix some bugs in
sys_domicrosleep.
6 jobs for microsleep-fixes in 142 minutes and 39 seconds (queued for 5 seconds)
Name Stage Failure
failed
raspbian_stretch_armv7l_deb Test There has been a timeout failure or the job got stuck. Check your timeout limits or try again
No job log
failed
windows_i386_innosetup Test There has been a runner system failure, please try again
Creating new VM...
WARNING: Failed to create snapshot ci from base VM MSEdge - Win10
ERROR: Preparation failed: VBoxManageOutput error: VBoxManage: error: Could not find a registered machine named 'MSEdge - Win10'
VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee nsISupports
VBoxManage: error: Context: "FindMachine(Bstr(pszSrcName).raw(), srcMachine.asOutParam())" at line 560 of file VBoxManageMisc.cpp
Will be retried in 3s ...
ERROR: Job failed (system failure): VBoxManageOutput error: VBoxManage: error: Could not find a registered machine named 'MSEdge - Win10'
VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee nsISupports
VBoxManage: error: Context: "FindMachine(Bstr(pszSrcName).raw(), srcMachine.asOutParam())" at line 560 of file VBoxManageMisc.cpp