| Previous | Next |
| ERROR_WX86_ERROR | ERROR_UNWIND |
ERROR_TIMER_NOT_CANCELED
The timer operation came from the wrong thread
ERROR_TIMER_NOT_CANCELED indicates that code attempted to cancel or modify a timer associated with an APC from a thread other than the one that originally established that APC relationship. The restriction is about thread ownership, not merely timer identity.
Common causes
- A worker creates the timer but a coordinator performs cleanup.
- Thread-pool reuse obscures which thread owns the APC state.
- Shutdown code migrates cancellation to another thread.
- A timer object is shared without documenting thread affinity.
Diagnosis
Record the creator thread ID, caller thread ID, timer handle, APC routine, and lifecycle transitions. Confirm that the creating thread still exists and can execute cleanup.
Correct design
Route cancellation to the owning thread through a control queue or event. Encapsulate timer creation and destruction in one thread-affine object. Avoid APC-based designs when work must be freely canceled from arbitrary threads.
Shutdown behavior
Do not close related resources until ownership cleanup is complete. A forced teardown can leave callbacks racing with object destruction.
References
Looking for a different code? Search another status or error code.