I want to run a long running opeartion in the background. The requirements are:
The operation should run async to the calling thread.
The calling thread can wait on the operation to complete and obtain its result
Upon timeout, the operation should be aborted at once.
I would have used task, but there is no mechanism that I know of to kill the task dead cold. Cancel token is not suitable for me, I would only kill a task if it gets stuck for unknown reason - (a bug) , this is a fail-safe mechanism. Needles to say if the task is stuck, there is no use in requesting cancel. Same goes for BackgroundWorker.
Is there anything more elagent than using a shared object between the calling thread and a background thread?