public boolean cancel(boolean mayInterruptIfRunning) {
        if (!started || done || cancelled) return false;

        if (mayInterruptIfRunning) {
            // interrupt
            cancelled = true;
            done = true;
        } else {
            // still running but cannot interrupt
            cancelled = false;
        }

        return cancelled;
    }