Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java JPype不';你不能在线程内工作吗?_Java_Python_Porting - Fatal编程技术网

Java JPype不';你不能在线程内工作吗?

Java JPype不';你不能在线程内工作吗?,java,python,porting,Java,Python,Porting,我测试了一个简单的hello world行来测试JPype: jpype.java.lang.System.out.println(“hello world”) 它在“主”python程序的上下文中非常有效。但是,在运行线程的上下文中,我得到以下响应: # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007f5272aeb226, pid=7888,

我测试了一个简单的hello world行来测试JPype:

jpype.java.lang.System.out.println(“hello world”)

它在“主”python程序的上下文中非常有效。但是,在运行线程的上下文中,我得到以下响应:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f5272aeb226, pid=7888, tid=139991902578432
#
# JRE version: 7.0_01-b08
# Java VM: Java HotSpot(TM) 64-Bit Server VM (21.1-b02 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [_jpype.so+0x33226]  JPJavaEnv::FindClass(char const*)+0x36
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/imedia/NTsvm/src/server/nlp/hs_err_pid7888.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
#
Aborted
引自:

Python线程

在大多数情况下,基于操作系统级线程(即posix线程)的python线程可以正常工作。唯一需要记住的是在线程体中调用
jpype.attachThreadToJVM()
,使JVM可以从该线程使用。对于不自己启动的线程,可以调用
isThreadAttachedToJVM()
进行检查