added pthread_cancel. doesnt seem to be working