Fix for BC pipes deadlock, refactoring of ThreadManager

Signed-off-by: Ross Allan <rallanpcl@gmail.com>