Re: [PATCH; python-imaging-sane] Py_*_ALLOW_THREADS for sane_get_devices and sane_open calls

Fredrik Lundh <[email protected]>
Newsgroups gmane.comp.python.image
Message-ID <[email protected]>
Added to trunk. Thanks! /F

2010/12/28 Sandro Mani <[email protected]>:
> Hi, following patch also adds Py_*_ALLOW_THREADS macros around the
> sane_get_devices and sane_open calls which can take a long time especially
> if network-scanners are accessed.
>
> --- Imaging-1.1.7.orig/Sane/_sane.c    2009-11-01 01:44:12.000000000 +0100
> +++ Imaging-1.1.7/Sane/_sane.c    2010-12-28 02:17:38.626022947 +0100
> @@ -1162,8 +1162,9 @@
>     {
>       return NULL;
>     }
> -
> +  Py_BEGIN_ALLOW_THREADS
>   st=sane_get_devices(&devlist, local_only);
> +  Py_END_ALLOW_THREADS
>   if (st) return PySane_Error(st);
>   if (!(list = PyList_New(0)))
>         return NULL;
> @@ -1191,7 +1192,9 @@
>     rv = newSaneDevObject();
>     if ( rv == NULL )
>         return NULL;
> +    Py_BEGIN_ALLOW_THREADS
>     st = sane_open(name, &(rv->h));
> +    Py_END_ALLOW_THREADS
>     if (st)
>       {
>         Py_DECREF(rv);
>
> _______________________________________________
> Image-SIG maillist  -  [email protected]
> http://mail.python.org/mailman/listinfo/image-sig
>
_______________________________________________
Image-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/image-sig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.