title: RxJava: How to interrupt thread on unsubscribe?
body: <p>I use <code>Observable.create()</code> to create an observable to perform some work on a scheduler (e.g. <code>Schedulers.io()</code> and then return a result on <code>AndroidSchedulers.mainThread()</code>.</p>
  
  <pre><code>val subscription = observable&lt;T&gt; {
          try {
              // perform action synchronously
              it.onNext(action.invoke(context, args))
              it.onCompleted()
          } catch (t: Exception) {
              it.onError(t)
          }
      }.subscribeOn(scheduler)
              .observeOn(AndroidSchedulers.mainThread())
              .subscribe(
                      {
                          // handle result here
                          result.set(it)
                      },
                      {
                          // handle error here
                          errorHandler.handleTaskError(model, this, it)
                      },
                      {
                          // notify completed
                          model.completeTask(this)
                      }
              )
  </code></pre>
  
  <p>The operation inside <code>action.invoke()</code> is synchronous and might be a blocking IO operation. When user decides to cancel it, I unsubscribe from the observable: <code>subscription.unsubscribe()</code></p>
  
  <p>However, the I/O operation is not being interrupted. Is there any rx-java API to interrupt the operation?</p>