HPCC-0000 Get the threading right

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>