Adding support for pthread_cancel