Exception handling for errors from the JVM

Added a wrapper class around a POSIX Threads condition variable to allow
RAII behaviour around signalling the condition.