You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by va...@apache.org on 2009/03/11 00:06:56 UTC

svn commit: r752295 - in /lucene/pylucene/trunk/jcc: CHANGES jcc/sources/jcc.cpp

Author: vajda
Date: Tue Mar 10 23:06:56 2009
New Revision: 752295

URL: http://svn.apache.org/viewvc?rev=752295&view=rev
Log:
 - added isCurrentThreadAttached() method to VMEnv

Modified:
    lucene/pylucene/trunk/jcc/CHANGES
    lucene/pylucene/trunk/jcc/jcc/sources/jcc.cpp

Modified: lucene/pylucene/trunk/jcc/CHANGES
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/CHANGES?rev=752295&r1=752294&r2=752295&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/CHANGES (original)
+++ lucene/pylucene/trunk/jcc/CHANGES Tue Mar 10 23:06:56 2009
@@ -1,6 +1,4 @@
 
-For bug <NUM>, see http://bugzilla.osafoundation.org/show_bug.cgi?id=<NUM>
-
 Version 2.1 ->
 ------------------
  - JCC now a subproject of the Apache PyLucene project
@@ -14,6 +12,8 @@
  - added 'bool' and 'operator' to list of reserved words
  - added support for packages and classes named with C++ reserved words
  - static methods shadowed by non-static methods of same name now '_' suffixed
+ - added 'java.lang' to --package by default
+ - added isCurrentThreadAttached() method to VMEnv
  - 
 
 Version 2.0 -> 2.1
@@ -31,7 +31,7 @@
 Version 1.9 -> 2.0
 ------------------
  - fixed bug with failed findClass() import
- - fixed bug 12127
+ - fixed bug http://bugzilla.osafoundation.org/show_bug.cgi?id=12127
  - added -ljvm to linux2 and sunos5 LFLAGS
  - added support for using JCC in reverse (starting from Java VM) (shared only)
  - using PythonException for reporting Python errors (shared only)

Modified: lucene/pylucene/trunk/jcc/jcc/sources/jcc.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/sources/jcc.cpp?rev=752295&r1=752294&r2=752295&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/sources/jcc.cpp (original)
+++ lucene/pylucene/trunk/jcc/jcc/sources/jcc.cpp Tue Mar 10 23:06:56 2009
@@ -41,6 +41,7 @@
 static void t_jccenv_dealloc(t_jccenv *self);
 static PyObject *t_jccenv_attachCurrentThread(PyObject *self, PyObject *args);
 static PyObject *t_jccenv_detachCurrentThread(PyObject *self);
+static PyObject *t_jccenv_isCurrentThreadAttached(PyObject *self);
 static PyObject *t_jccenv_strhash(PyObject *self, PyObject *arg);
 static PyObject *t_jccenv__dumpRefs(PyObject *self,
                                     PyObject *args, PyObject *kwds);
@@ -54,6 +55,8 @@
       METH_VARARGS, NULL },
     { "detachCurrentThread", (PyCFunction) t_jccenv_detachCurrentThread,
       METH_NOARGS, NULL },
+    { "isCurrentThreadAttached", (PyCFunction) t_jccenv_isCurrentThreadAttached,
+      METH_NOARGS, NULL },
     { "strhash", (PyCFunction) t_jccenv_strhash,
       METH_O, NULL },
     { "_dumpRefs", (PyCFunction) t_jccenv__dumpRefs,
@@ -158,9 +161,20 @@
 static PyObject *t_jccenv_detachCurrentThread(PyObject *self)
 {
     int result = env->vm->DetachCurrentThread();
+
+    env->set_vm_env(NULL);
+
     return PyInt_FromLong(result);
 }
 
+static PyObject *t_jccenv_isCurrentThreadAttached(PyObject *self)
+{
+    if (env->get_vm_env() != NULL)
+        Py_RETURN_TRUE;
+
+    Py_RETURN_FALSE;
+}
+
 static PyObject *t_jccenv_strhash(PyObject *self, PyObject *arg)
 {
     int hash = PyObject_Hash(arg);