Commit ebac17d8 authored by Xavier Thompson's avatar Xavier Thompson

Let _active_result_class be NULL by default

In this case, asynchronous method calls will return NULL themselves.
parent ec1927a8
...@@ -1055,7 +1055,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1055,7 +1055,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
templates_code = "template <typename %s>" % ", typename ".join(t.name for t in entry.type.templates) templates_code = "template <typename %s>" % ", typename ".join(t.name for t in entry.type.templates)
code.putln(templates_code) code.putln(templates_code)
code.putln("%s {" % function_code) code.putln("%s {" % function_code)
code.putln("%s = this->%s();" % (result_interface_type.declaration_code("result_object"), result_attr_cname)) result_declaration = result_interface_type.declaration_code("result_object")
code.putln("%s = this->%s ? this->%s() : NULL;" % (result_declaration, result_attr_cname, result_attr_cname))
message_constructor_args_list = ["this", "sync_object", "result_object"] + reified_arg_cname_list message_constructor_args_list = ["this", "sync_object", "result_object"] + reified_arg_cname_list
message_constructor_args_code = ", ".join(message_constructor_args_list) message_constructor_args_code = ", ".join(message_constructor_args_list)
...@@ -1196,12 +1197,14 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1196,12 +1197,14 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
) )
if does_return: if does_return:
code.putln("if (this->%s != NULL) {" % result_attr_cname)
code.putln("Cy_WLOCK(this->%s);" % result_attr_cname) code.putln("Cy_WLOCK(this->%s);" % result_attr_cname)
if reified_function_entry.type.return_type.resolve() is PyrexTypes.c_int_type: if reified_function_entry.type.return_type.resolve() is PyrexTypes.c_int_type:
code.putln("this->%s->pushIntResult(result);" % result_attr_cname) code.putln("this->%s->pushIntResult(result);" % result_attr_cname)
else: else:
code.putln("this->%s->pushVoidStarResult((void*)result);" % result_attr_cname) code.putln("this->%s->pushVoidStarResult((void*)result);" % result_attr_cname)
code.putln("Cy_UNWLOCK(this->%s);" % result_attr_cname) code.putln("Cy_UNWLOCK(this->%s);" % result_attr_cname)
code.putln("}")
code.putln("return 1;") code.putln("return 1;")
code.putln("}") code.putln("}")
......
...@@ -390,7 +390,7 @@ ...@@ -390,7 +390,7 @@
struct ActhonActivableClass : public CyObject { struct ActhonActivableClass : public CyObject {
ActhonQueueInterface *_active_queue_class = NULL; ActhonQueueInterface *_active_queue_class = NULL;
ActhonResultInterface *(*_active_result_class)(void); ActhonResultInterface *(*_active_result_class)(void) = NULL;
ActhonActivableClass(){} // Used in Activated classes inheritance chain (base Activated calls this, derived calls the 2 args version below) ActhonActivableClass(){} // Used in Activated classes inheritance chain (base Activated calls this, derived calls the 2 args version below)
virtual ~ActhonActivableClass(); virtual ~ActhonActivableClass();
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment