Thread safety patch for Python STL iterators from Abhinandan Jain
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10317 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
fe15a5a87c
commit
a1100e9964
2 changed files with 13 additions and 5 deletions
|
|
@ -1,6 +1,9 @@
|
|||
Version 1.3.35 (in progress)
|
||||
============================
|
||||
|
||||
03/21/2008: wsfulton
|
||||
[Python] Thread safety patch for STL iterators from Abhinandan Jain.
|
||||
|
||||
03/17/2008: mgossage
|
||||
[Lua] Added %luacode feature to add source code into wrappers.
|
||||
Updated documentation to document this.
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* Implement a python 'output' iterator for Python 2.2 or higher.
|
||||
*
|
||||
* Users can derive form the PySwigIterator to implemet their
|
||||
* Users can derive form the PySwigIterator to implement their
|
||||
* own iterators. As an example (real one since we use it for STL/STD
|
||||
* containers), the template PySwigIterator_T does the
|
||||
* implementation for genereic C++ iterators.
|
||||
|
|
@ -57,17 +57,22 @@ namespace swig {
|
|||
// C++ common/needed methods
|
||||
virtual PySwigIterator *copy() const = 0;
|
||||
|
||||
PyObject *next()
|
||||
PyObject *next()
|
||||
{
|
||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK; // disable threads
|
||||
PyObject *obj = value();
|
||||
incr();
|
||||
return obj;
|
||||
incr();
|
||||
SWIG_PYTHON_THREAD_END_BLOCK; // re-enable threads
|
||||
return obj;
|
||||
}
|
||||
|
||||
PyObject *previous()
|
||||
{
|
||||
SWIG_PYTHON_THREAD_BEGIN_BLOCK; // disable threads
|
||||
decr();
|
||||
return value();
|
||||
PyObject *obj = value();
|
||||
SWIG_PYTHON_THREAD_END_BLOCK; // re-enable threads
|
||||
return obj;
|
||||
}
|
||||
|
||||
PySwigIterator *advance(ptrdiff_t n)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue