Implement currentThread on Unix. Closes #663