Add per-thread initialize/finalizer and data

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>