[Dev] [Cynara] Async client API v3.0 proposal

José Bollo jose.bollo at open.eurogiciel.org
Mon Sep 1 07:47:51 GMT 2014


few comments below

On sab, 2014-08-30 at 22:15 +0200, Lukasz Wojciechowski wrote:
(snip)
>   - Patrick would like to receive errors by callbacks [we can still 
> discuss that on dev-list or gerrit review, but Patrick mark that as far 
> as I know, You are alone in this opinion]

I'm filling confortable with the proposal of Patrick. So confortable
that I agree with him.

Let try an example using this last proposal. Imagine that you are inside
DBUS and that you have to deal with sync/async.

example 1: the current proposal
-------------------------------

  sts = cynara_async_check(...)
  if (sts ...) {
    /* synchronous answer */
  } else {
    sts = cynara_async_create_request(...)
    if (sts ...) {
      /* synchronous error */
    } else {
      /* asynchronous */
    }
  }

example 2: the current proposal with Patrick's rule
---------------------------------------------------

  sts = cynara_async_check(...)
  if (sts ...) {
    /* synchronous answer */
  } else {
    /* asynchronous */
    cynara_async_create_request(...)
  }

example 3: the simplest (my preferred)
-----------------------

  cynara_async_check(...,callback,data)
  if (data filled by callback) {
    /* synchronous answer */
  } else {
    /* asynchronous */
  }

I have nothing more to add because I'm trusting your work.

Best regards
José




More information about the Dev mailing list