Boost logo

Boost :

From: dustin_at_[hidden]
Date: 2001-06-25 17:45:06


Thank you for your reply. Here is what I want to accomplish:

1. A long running C++ method within the extension module monitors a
flag, and exits if the flag is true.
2. A seperate python thread sets the flag when the user hits a cancel
button.

In order to do this, I will have to release the interpreter lock, so
that the user interface thread can execute. Can I safely set a
boolean value within the extension module from the user interface
thread while the main thread executes within the extension module?

Again, thank you for any assistance, and I apologize if this is not
the proper venue for my question.

--- In boost_at_y..., Ullrich Koethe <u.koethe_at_c...> wrote:
> dustin_at_d... wrote:
> >
> > Please excuse my relative ignorance. My question is: I've written
a
> > Python Extension module in C++ using the Boost Python library. If
I
> > understand correctly, the thread in which my extension module
> > executes will maintain a lock on the Python interpreter while
> > executing within the extension module, preventing other python
> > threads from executing. Can I get around this by releasing the
> > interpreter lock? Any assistance would be greatly appreciated.
>
> It should be safe to release the interpreter lock while C++ code is
> executing, provided that C++ doesn't:
>
> - call, directly or indirectly, any functions from the Python C API
> - use any C++ objects accessible by other Python threads (if not
> otherwise guarded)
>
> while this thread doesn't have the lock.
>
> Ulli
> --
> ________________________________________________________________
> | |
> | Ullrich Koethe Universität Hamburg / University of Hamburg |
> | FB Informatik / Dept. of Computer Science |
> | AB Kognitive Systeme / Cognitive Systems Group |
> | |
> | Phone: +49 (0)40 42883-2573 Vogt-Koelln-Str. 30 |
> | Fax: +49 (0)40 42883-2572 D - 22527 Hamburg |
> | Email: u.koethe_at_c... Germany |
> | koethe_at_i... |
> | WWW: http://kogs-www.informatik.uni-hamburg.de/~koethe/ |
> |________________________________________________________________|


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk