[capi] code cleanup
[x0d] adds shared function sleep(n) - purely for demo use