This is a simple implementation that uses 3 booleans to keep state (inQueue, isCanceled, hadTimeoutWhenCanceled). I'd like to do a follow-up change to replace 3 booleans with a proper state variable, especially since that eliminates some impossible states (like inQueue and isCanceled).
This is a simple implementation that uses 3 booleans to keep state (inQueue, isCanceled, hadTimeoutWhenCanceled). I'd like to do a follow-up change to replace 3 booleans with a proper state variable, especially since that eliminates some impossible states (like inQueue and isCanceled).