Add support for wait fork to the compiler and code generators