We need to ensure the inter-thread messaging queues are empty (more specifically, not locked) before destroying them. The best way to ensure that is to explicitly wait for thread termination.