Attempt to fix race condition.

There was a race condition in vtkDataEncoder when terminating all worker
threads. There was a potential that worker threads would terminate just before
the master thread started to wait for them to terminate. This patch addresses
that issue by ensure that no threads can terminate until the master thread
starts to wait for them.

Change-Id: I7c9b7571e03b7d19a30329403d5c4dbfc3c2ad3e
Merge topic 'fix_test_set_get' into master

48341708 Attempt to fix race condition.