added a mechanism safely to shutdown the ArmZabbixAPI thread.

However, this patch is enough. The thread now checks the exit
request every polling interval. Otherwise it is just sleeping.
We want the thread to wake up soon and start the exit process.