Added functions to attach/detach native threads to the JVM