static PHP_METHOD(swoole_coroutine_util, call_user_func)
{
	zend_fcall_info fci;
	zend_fcall_info_cache fci_cache;

	ZEND_PARSE_PARAMETERS_START(1, -1)
		Z_PARAM_FUNC(fci, fci_cache)
		Z_PARAM_VARIADIC('*', fci.params, fci.param_count)
	ZEND_PARSE_PARAMETERS_END();

        fci.retval = (execute_data->prev_execute_data->opline->result_type != IS_UNUSED) ? return_value : NULL;
        swoole_corountine_call_function(&fci, &fci_cache, 0);
}
Example #2
0
/** public function ION\Sequence::__invoke(mixed ...$data) : void */
CLASS_METHOD(ION_Sequence, __invoke) {
    zval * data = NULL;
    int    count = 0;

    ZEND_PARSE_PARAMETERS_START(0, 255)
        Z_PARAM_VARIADIC('*', data, count);
    ZEND_PARSE_PARAMETERS_END_EX(PION_ZPP_THROW);

    if(!count) {
        zval nil;
        ZVAL_NULL(&nil);
        ion_promisor_sequence_invoke(Z_OBJ_P(getThis()), &nil);
    } else if(count == 1) {
        ion_promisor_sequence_invoke(Z_OBJ_P(getThis()), data);
    } else {
        ion_promisor_sequence_invoke_args(Z_OBJ_P(getThis()), data, count);
    }
}