# vim: set ft=c:

MPIX_Async_start:
    poll_fn: FUNCTION, func_type=MPIX_Async_poll_function, [user defined poll function for progressing async things]
    extra_state: EXTRA_STATE, [extra state for callback function]
    stream: STREAM, [stream object]
{
    mpi_errno = MPIR_Async_things_add(poll_fn, extra_state, stream_ptr);
    if (mpi_errno) goto fn_fail;
}

MPIX_Async_get_state:
    .return: EXTRA_STATE
    async_thing: ASYNC_THING, [opaque pointer for async thing]
    .impl: direct
{
    return MPIR_Async_thing_get_state(async_thing);
}

MPIX_Async_spawn:
    async_thing: ASYNC_THING, [opaque pointer for async thing]
    poll_fn: FUNCTION, func_type=MPIX_Async_poll_function, [user defined poll function for progressing async things]
    extra_state: EXTRA_STATE, [extra state for callback function]
    stream: STREAM, [stream object]
{
    mpi_errno = MPIR_Async_thing_spawn(async_thing, poll_fn, extra_state, stream_ptr);
    if (mpi_errno) goto fn_fail;
}
