From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: Euan Harris <euan.harris@citrix.com>
Cc: xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2 3/3] python: Add binding for non-blocking xs_check_watch()
Date: Thu, 21 Sep 2017 20:09:23 +0200 [thread overview]
Message-ID: <20170921180923.GH1116@mail-itl> (raw)
In-Reply-To: <1506012428-59769-4-git-send-email-euan.harris@citrix.com>
[-- Attachment #1.1: Type: text/plain, Size: 2308 bytes --]
On Thu, Sep 21, 2017 at 05:47:08PM +0100, Euan Harris wrote:
> xs_check_watch() checks for watch notifications without blocking.
> Together with the binding for xs_fileno(), this makes it possible
> to write event-driven clients in Python.
>
> Signed-off-by: Euan Harris <euan.harris@citrix.com>
> Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> ---
> tools/python/xen/lowlevel/xs/xs.c | 28 ++++++++++++++++++++++++++++
> 1 file changed, 28 insertions(+)
>
> diff --git a/tools/python/xen/lowlevel/xs/xs.c b/tools/python/xen/lowlevel/xs/xs.c
> index 2af5e07..4710002 100644
> --- a/tools/python/xen/lowlevel/xs/xs.c
> +++ b/tools/python/xen/lowlevel/xs/xs.c
> @@ -474,6 +474,33 @@ static PyObject *xspy_fileno(XsHandle *self)
> }
>
>
> +#define xspy_check_watch_doc "\n" \
> + "Check for watch notifications without blocking.\n" \
> + "\n" \
> + "Returns: [tuple] (path, token).\n" \
> + " None if no watches have fired.\n" \
> + "Raises xen.lowlevel.xs.Error on error.\n" \
> + "\n"
> +
> +static PyObject *xspy_check_watch(XsHandle *self, PyObject *args)
> +{
> + struct xs_handle *xh = xshandle(self);
> + PyObject *val = NULL;
> + char **xsval;
> +
> + if (!xh)
> + return NULL;
> +
> + xsval = xs_check_watch(xh);
> + if (!xsval) {
> + return none(errno == EAGAIN);
> + }
> +
> + val = match_watch_by_token(self, xsval);
> + free(xsval);
> + return val;
> +}
> +
> #define xspy_read_watch_doc "\n" \
> "Read a watch notification.\n" \
> "\n" \
> @@ -911,6 +938,7 @@ static PyMethodDef xshandle_methods[] = {
> XSPY_METH(set_permissions, METH_VARARGS),
> XSPY_METH(watch, METH_VARARGS),
> XSPY_METH(read_watch, METH_NOARGS),
> + XSPY_METH(check_watch, METH_NOARGS),
> XSPY_METH(unwatch, METH_VARARGS),
> XSPY_METH(transaction_start, METH_NOARGS),
> XSPY_METH(transaction_end, METH_VARARGS | METH_KEYWORDS),
--
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
[-- Attachment #2: Type: text/plain, Size: 127 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
prev parent reply other threads:[~2017-09-21 18:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-21 16:47 [PATCH v2 0/3] python: Add non-blocking Xenstore watch bindings Euan Harris
2017-09-21 16:47 ` [PATCH v2 1/3] python: Add binding for xs_fileno() Euan Harris
2017-09-21 18:04 ` Marek Marczykowski-Górecki
2017-09-21 16:47 ` [PATCH v2 2/3] python: Extract registered watch search logic from xspy_read_watch() Euan Harris
2017-09-21 18:07 ` Marek Marczykowski-Górecki
2017-09-21 16:47 ` [PATCH v2 3/3] python: Add binding for non-blocking xs_check_watch() Euan Harris
2017-09-21 18:09 ` Marek Marczykowski-Górecki [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170921180923.GH1116@mail-itl \
--to=marmarek@invisiblethingslab.com \
--cc=euan.harris@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.