From 9bddd286a935019654273c0097b790c58255b6a4 Mon Sep 17 00:00:00 2001 From: benfry Date: Tue, 28 Sep 2004 05:54:26 +0000 Subject: [PATCH] more bug fixes for libs, especially serial, and a threading issue --- processing/build/linux/make.sh | 1 + processing/build/macosx/make.sh | 2 ++ processing/build/windows/make.sh | 2 ++ processing/core/PApplet.java | 36 ++++++++++++++++++-------------- processing/todo.txt | 5 +++-- 5 files changed, 28 insertions(+), 18 deletions(-) diff --git a/processing/build/linux/make.sh b/processing/build/linux/make.sh index 29d45703e..18a269b0a 100755 --- a/processing/build/linux/make.sh +++ b/processing/build/linux/make.sh @@ -9,6 +9,7 @@ then else echo Setting up directories to build for linux... cp -r ../shared work + cp -r ../../lib work/libraries cd work unzip -q examples.zip diff --git a/processing/build/macosx/make.sh b/processing/build/macosx/make.sh index fc1bf94e7..f221a5578 100755 --- a/processing/build/macosx/make.sh +++ b/processing/build/macosx/make.sh @@ -18,6 +18,8 @@ else echo Setting up directories to build under Mac OS X cp -r ../shared work + cp -r ../../lib work/libraries + echo Extracting examples... cd work unzip -q examples.zip diff --git a/processing/build/windows/make.sh b/processing/build/windows/make.sh index 7fda90ec1..193e7bdad 100755 --- a/processing/build/windows/make.sh +++ b/processing/build/windows/make.sh @@ -12,6 +12,8 @@ else rm -f work/.DS_Store # in case one of those little mac poopers show up + cp -r ../../lib work/libraries + echo Extracting examples... cd work unzip -q examples.zip diff --git a/processing/core/PApplet.java b/processing/core/PApplet.java index c1c682c61..574152df6 100644 --- a/processing/core/PApplet.java +++ b/processing/core/PApplet.java @@ -57,7 +57,7 @@ public class PApplet extends Applet public String folder; // = System.getProperty("user.dir"); /** When debugging headaches */ - static final boolean THREAD_DEBUG = false; //true; + static final boolean THREAD_DEBUG = false; public int pixels[]; @@ -373,12 +373,16 @@ public class PApplet extends Applet } public void loop() { + //println("loop 1"); if (!looping) { + //println("loop 2"); looping = true; if (thread != null) { + //println("loop 3"); //println(Thread.currentThread().getName()); //println("loop wakeup"); thread.interrupt(); // wake from sleep + //println("loop 4"); } } } @@ -489,6 +493,7 @@ public class PApplet extends Applet public void run() { try { while ((Thread.currentThread() == thread) && !finished) { + //while (!finished) { //updated = false; if (PApplet.THREAD_DEBUG) println(Thread.currentThread().getName() + @@ -559,24 +564,23 @@ public class PApplet extends Applet // separate thread, meaning that the next frame will start // before the update/paint is completed //while (!updated) { - try { - if (THREAD_DEBUG) println(Thread.currentThread().getName() + + try { + if (THREAD_DEBUG) println(Thread.currentThread().getName() + " " + looping + " " + redraw); - //Thread.yield(); - // windows doesn't like 'yield', so have to sleep at least - // for some small amount of time. - if (THREAD_DEBUG) println(Thread.currentThread().getName() + - " gonna sleep"); - // can't remember when/why i changed that to '1'.. - // i have a feeling that some applets aren't gonna like that - Thread.sleep(looping ? 1 : 10000); // sleep to make OS happy - if (THREAD_DEBUG) println(Thread.currentThread().getName() + - " outta sleep"); - } catch (InterruptedException e) { - break; - } + //Thread.yield(); + // windows doesn't like 'yield', so have to sleep at least + // for some small amount of time. + if (THREAD_DEBUG) println(Thread.currentThread().getName() + + " gonna sleep"); + // can't remember when/why i changed that to '1'.. + // i have a feeling that some applets aren't gonna like that + Thread.sleep(looping ? 1 : 10000); // sleep to make OS happy + if (THREAD_DEBUG) println(Thread.currentThread().getName() + + " outta sleep"); + } catch (InterruptedException e) { } //} } + } catch (Exception e) { // formerly in kjcapplet, now just checks to see // if someone wants to leech off errors diff --git a/processing/todo.txt b/processing/todo.txt index 272f8856e..c49a38752 100644 --- a/processing/todo.txt +++ b/processing/todo.txt @@ -239,8 +239,9 @@ X remove sketchbook -> libraries until it works X serial_setup.command is missing from osx distribution X fix the note in the readme about it X properly import qtjava from processing.exe - -_ fix the default network, camera, serial examples +X fix the default network, camera, serial examples +X extra libraries for libs not being imported +X fix threading issue, don't call "break" with casey