[lxc-devel] attach_wait and threads
Stéphane Graber
stgraber at ubuntu.com
Mon Jul 7 13:55:45 UTC 2014
On Mon, Jul 07, 2014 at 08:53:35AM -0500, Serge Hallyn wrote:
> Quoting Dorian Eikenberg (Dorian.Eikenberg at uni-duesseldorf.de):
> > Hi,
> >
> > attaching to a container using attach_wait from python-lxc blocks all other threads since it is not GIL-aware.
> > This can be a problem if you want to run a timer thread, which stops the container after a certain timeout has occured.
> > I've provided a solution below:
> >
>
> Could you please add a Signed-off-by line? You can add
>
> Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>
>
> below that.
>
> The lxc part of the api code is thread-safe, so if there is a more
> general way to tell python to always allow threads, that would be
> good too.
He did add a Signed-off-by to the e-mail, just not in the header :)
Acked-by: Stéphane Graber <stgraber at ubuntu.com>
>
> > diff --git a/src/python-lxc/lxc.c b/src/python-lxc/lxc.c
> > index 1bc977a..91c199f 100644
> > --- a/src/python-lxc/lxc.c
> > +++ b/src/python-lxc/lxc.c
> > @@ -581,7 +581,9 @@ Container_attach_and_possibly_wait(Container *self, PyObject *args,
> > goto out;
> >
> > if (wait) {
> > + Py_BEGIN_ALLOW_THREADS
> > ret = lxc_wait_for_pid_status(pid);
> > + Py_END_ALLOW_THREADS
> > /* handle case where attach fails */
> > if (WIFEXITED(ret) && WEXITSTATUS(ret) == 255)
> > ret = -1;
> >
> >
> > Signed-off-by: Dorian Eikenberg <dorian.eikenberg at uni-duesseldorf.de>
>
> > _______________________________________________
> > lxc-devel mailing list
> > lxc-devel at lists.linuxcontainers.org
> > http://lists.linuxcontainers.org/listinfo/lxc-devel
>
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel
--
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140707/9bba9f17/attachment.sig>
More information about the lxc-devel
mailing list