added cancellation_token for thread exit

This is a fix for 148 (removing kills). Actually, it is a workaround for current thread implementation.
I hope I'll replace it by either Poco one or std or make it configurable like regex while moving to Win64.