move register_async_function to a header