ccode.add_declaration ("GUnixFDList", new CCodeVariableDeclarator ("*_fd_list"));
ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("_fd_list"), new CCodeFunctionCall (new CCodeIdentifier ("g_unix_fd_list_new"))));
+ CCodeExpression cancellable = new CCodeConstant ("NULL");
+
foreach (FormalParameter param in m.get_parameters ()) {
if (param.direction == ParameterDirection.IN) {
CCodeExpression expr = new CCodeIdentifier (param.name);
expr = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, expr);
}
+ if (param.variable_type is ObjectType && param.variable_type.data_type.get_full_name () == "GLib.Cancellable") {
+ cancellable = expr;
+ continue;
+ }
+
send_dbus_value (param.variable_type, new CCodeIdentifier ("_arguments_builder"), expr, param);
}
}
ccall.add_argument (new CCodeConstant ("G_DBUS_SEND_MESSAGE_FLAGS_NONE"));
ccall.add_argument (timeout);
ccall.add_argument (new CCodeConstant ("NULL"));
- ccall.add_argument (new CCodeConstant ("NULL"));
+ ccall.add_argument (cancellable);
ccall.add_argument (new CCodeIdentifier ("error"));
ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("_reply_message"), ccall));
} else if (call_type == CallType.NO_REPLY) {
ccall.add_argument (new CCodeConstant ("G_DBUS_SEND_MESSAGE_FLAGS_NONE"));
ccall.add_argument (timeout);
ccall.add_argument (new CCodeConstant ("NULL"));
- ccall.add_argument (new CCodeConstant ("NULL"));
+ ccall.add_argument (cancellable);
// use wrapper as source_object wouldn't be correct otherwise
ccall.add_argument (new CCodeIdentifier (generate_async_callback_wrapper ()));
continue;
}
+ if (param.variable_type is ObjectType && param.variable_type.data_type.get_full_name () == "GLib.Cancellable") {
+ continue;
+ }
+
var owned_type = param.variable_type.copy ();
owned_type.value_owned = true;
foreach (FormalParameter param in m.get_parameters ()) {
if (param.direction == ParameterDirection.IN && !ready) {
+ if (param.variable_type is ObjectType && param.variable_type.data_type.get_full_name () == "GLib.Cancellable") {
+ ccall.add_argument (new CCodeConstant ("NULL"));
+ continue;
+ }
+
var st = param.variable_type.data_type as Struct;
if (st != null && !st.is_simple_type ()) {
ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (param.name)));
foreach (FormalParameter param in m.get_parameters ()) {
if ((param.direction == ParameterDirection.IN && !ready) ||
(param.direction == ParameterDirection.OUT && !no_reply && (!m.coroutine || ready))) {
+ if (param.variable_type is ObjectType && param.variable_type.data_type.get_full_name () == "GLib.Cancellable") {
+ continue;
+ }
+
var owned_type = param.variable_type.copy ();
owned_type.value_owned = true;
var out_args_info = new CCodeInitializerList ();
foreach (FormalParameter param in m.get_parameters ()) {
+ if (param.variable_type is ObjectType && param.variable_type.data_type.get_full_name () == "GLib.Cancellable") {
+ continue;
+ }
+
var info = new CCodeInitializerList ();
info.append (new CCodeConstant ("-1"));
info.append (new CCodeConstant ("\"%s\"".printf (param.name)));
public abstract async void test_void () throws Error;
public abstract async int test_int (int i, out int j) throws Error;
public abstract async string test_string (string s, out string t) throws Error;
+ public abstract async void test_cancellable (Cancellable? cancellable = null) throws Error;
}
MainLoop main_loop;
} catch {
}
+ try {
+ var cancellable = new Cancellable ();
+ cancellable.cancel ();
+ yield test.test_cancellable (cancellable);
+ assert_not_reached ();
+ } catch {
+ }
+
main_loop.quit ();
}
yield;
throw new IOError.FAILED ("Operation failed");
}
+
+ public async void test_cancellable (Cancellable? cancellable = null) throws Error {
+ Idle.add (test_cancellable.callback);
+ yield;
+ }
}
MainLoop main_loop;
public abstract void test_void () throws Error;
public abstract int test_int (int i, out int j) throws Error;
public abstract string test_string (string s, out string t) throws Error;
+ public abstract void test_cancellable (Cancellable? cancellable = null) throws Error;
}
void main () {
assert_not_reached ();
} catch {
}
+
+ try {
+ var cancellable = new Cancellable ();
+ cancellable.cancel ();
+ test.test_cancellable (cancellable);
+ assert_not_reached ();
+ } catch {
+ }
}
Program: server
public string test_string (string s, out string t) throws Error {
throw new IOError.FAILED ("Operation failed");
}
+
+ public void test_cancellable (Cancellable? cancellable = null) throws Error {
+ }
}
MainLoop main_loop;