The NMR APIs are designed to be completely asynchronous, with detach operations returning pending if the provider data is in use.
The Windows EX_RUNDOWN_REF are synchronous, with rundown blocking until completion.
The NMR API contract requires some form of rundown protection to prevent use after detach, but the only Windows API are synchronous ones.
Proposal:
Replace EX_RUNDOWN_REF with an asynchronous contract.
Consider using the epoch logic and return pending from the nmr detach. Then at end of epoch, signal complete. This would remove the need for an interlocked operation on the hot path.
The NMR APIs are designed to be completely asynchronous, with detach operations returning pending if the provider data is in use. The Windows EX_RUNDOWN_REF are synchronous, with rundown blocking until completion.
The NMR API contract requires some form of rundown protection to prevent use after detach, but the only Windows API are synchronous ones.
Proposal: Replace EX_RUNDOWN_REF with an asynchronous contract.