Debugging Help on workerthreads

Hello, I’m going to be as descriptive in my question as possible to well, help you help me.
I know that on line

ParticleSystem.java 59: input.read(tempByte0);
the program stalls as it waits for the thread to return with additional data, I don’t know why it deadlocks

What’s happening is there’s 4 sets of 4 bytes to read, and the first byte is used to check if it has work to perform.
SO the first byte has been taken out the stream so the next read is of 3 bytes which will be reconnected with the first byte for it’s original value.
Problem is, the deadlock occures on tempByte3 which i believe might be because the stream is empty :confused:

the github is here: https://github.com/Joshhua5/Particle-System/tree/master/ParticleSystem
Hope someone can help me

Looking at the source “input” seems to be a PipedInputStream class: http://docs.oracle.com/javase/6/docs/api/java/io/PipedInputStream.html

Most InputStreams have some sort of “available()” method to check how many bytes can be read form it.

So before reading check it by


if (input.available() > 0) {
// Do stuff
}

Okay so thanks to that nice function (Thank you) I’ve found out that 4 bytes aren’t being added to the stream, so maybe there’s a problem with the byteconversion class :confused: