Convert pidXwait() from macro to function