Revision: 563
http://svn.sourceforge.net/pygccxml/?rev=563&view=rev
Author: mbaas
Date: 2006-09-20 09:50:09 -0700 (Wed, 20 Sep 2006)
Log Message:
-----------
Added a new header file to the code repository that contains a class to acquire/release the Python GIL.
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/code_repository/__init__.py
Added Paths:
-----------
pyplusplus_dev/pyplusplus/code_repository/gil_state.py
Modified: pyplusplus_dev/pyplusplus/code_repository/__init__.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_repository/__init__.py 2006-09-20 16:46:04 UTC (rev 562)
+++ pyplusplus_dev/pyplusplus/code_repository/__init__.py 2006-09-20 16:50:09 UTC (rev 563)
@@ -14,4 +14,6 @@
"""
import array_1
-all = [ array_1 ]
\ No newline at end of file
+import gil_state
+
+all = [ array_1, gil_state ]
Added: pyplusplus_dev/pyplusplus/code_repository/gil_state.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_repository/gil_state.py (rev 0)
+++ pyplusplus_dev/pyplusplus/code_repository/gil_state.py 2006-09-20 16:50:09 UTC (rev 563)
@@ -0,0 +1,62 @@
+# Copyright 2004 Roman Yakovenko.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+"""
+This file contains C++ code to acquire/release the GIL.
+"""
+
+file_name = "__gil_state.pypp.hpp"
+
+code = \
+"""// Copyright 2004 Roman Yakovenko.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef __gil_state_pyplusplus_hpp__
+#define __gil_state_pyplusplus_hpp__
+
+namespace pyplusplus{
+
+class gil_state_t
+{
+ public:
+ gil_state_t( bool lock=false )
+ : m_locked( false )
+ {
+ if( lock )
+ ensure();
+ }
+
+ ~gil_state_t() {
+ release();
+ }
+
+ void ensure() {
+ if( !m_locked )
+ {
+ m_gstate = PyGILState_Ensure();
+ m_locked = true;
+ }
+ }
+
+ void release() {
+ if( m_locked )
+ {
+ PyGILState_Release(m_gstate);
+ m_locked = false;
+ }
+ }
+
+ private:
+ bool m_locked;
+ PyGILState_STATE m_gstate;
+};
+
+} /* pyplusplus*/
+
+
+#endif//__gil_state_pyplusplus_hpp__
+"""
Property changes on: pyplusplus_dev/pyplusplus/code_repository/gil_state.py
___________________________________________________________________
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|