Add thread counter support.
Threaded decrypt.
Fix some clang/threads issues.