On Tue, Mar 3, 2015 at 2:52 PM, Justin Ross <[email protected]> wrote:

> In PROTON-818, Cliff has introduced some examples using the C reactor
> interfaces.  For simple programs, they are pretty long.
>
>   - reactor-recv.c - http://goo.gl/4QkqsE - 447 lines
>   - reactor-send.c - http://goo.gl/Zcg9Sy - 389 lines
>
> Some questions:
>
>  - The examples carry connections in a context in order to do clean
> shutdown.  Is that something the reactor should be capable of doing?
>

I'm not 100% sure what you mean by this, but these programs do make
unnecessary use of both handlers and contexts. I asked about this in the
review and cliff said he wanted to test the capability. Based on that I was
assuming these weren't examples, but were actually tests.


>   - There's also a little extra logic in these to do clean object deletion.
> Is there a better way to handle the references to avoid this?
>

Yes, if you use an the attachments API rather than the context API then you
can declare your pointer to be refcounted and the cleanup will happen
automatically.


>
>  - There's some state management for timeouts.  Could that go into a
> standard handler?  It seems like it will be a common case.
>

There's a bunch of standard handler stuff in python that could be brought
into C. Unless there is an urgent need for it in C though it might be
better to let the python stuff get some use first.


>   - Can the endpoint setup in these examples go into a standard handler?
>

Yeah, (see previous answer).


>  - The message handling is verbose.  It seems attractive to have something
> akin to the message.send and .recv that we have in Python.
>

Yes, I expect to add that soon.

In general there is less syntactic sugar and a smaller handler library in C
than in python, so I would expect C examples to be a bit more verbose than
python. Even so, we should be able to provide a much more comparable
example. I think the parallel C/python example I posted a while back had a
much more concise send/recv embedded in it.

--Rafael

Reply via email to