Include missing h file

Signed-off-by: Sven Strickroth <email@cs-ware.de>
Wait for thread to exit cleanly

Signed-off-by: Sven Strickroth <email@cs-ware.de>