P2D and multithreading throws an error

edited April 2015 in Questions about Code

Hi, I am trying to use a separate thread with P2D renderer and it throws me an error. Without specifying P2D renderer, the sketch runs fine, but the text flickers. My project requires me to use the P2D renderer, so I am hoping to find a solution.

System info: Processing 2.2.1 (and also Processing 3.0a5), OS X Yosemite 10.10.3, Mackbook Pro Retina 15inch

Sameple code with the issue:

void setup() {
  size(400, 400, P2D);
}

void draw() {
  background(0);
  thread("displayText");
}

void displayText() {
  text("hello", 50, 50);
}

Error message:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fff893ac661, pid=4417, tid=86531
#
[thread 67335 also had an error]# JRE version: Java(TM) SE Runtime Environment (7.0_55-b13) (build 1.7.0_55-b13)

# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.55-b03 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C  [libGL.dylib+0x1661]  glEnable+0xf
#
# 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:
# /Users/daeinchung/hs_err_pid4417.log
[thread 85507 also had an error]
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Could not run the sketch (Target VM failed to initialize).
For more information, read revisions.txt and Help → Troubleshooting.

Answers

Sign In or Register to comment.