add cancellation

add simple implementation of cancellation support