Add a cancellation mechanism for blocking IO

This allows thread to cancel blocking IO performed by other threads.

Typically used to abort loading of an image, etc
icecast: Add cancellation to icecast