IHolder::Close

Closes the holder.

HRESULT IHolder::Close ();

Comments

This closes a resource dispenser's holder, after which the resource dispenser will probably be released.

Before closing, any remaining inventory is destroyed by calling back to the resource dispenser's DestroyResource.

The following sequence describes how to close down a resource dispenser.

  1. You must hold a reference to the resource dispenser (the object which exposes IDispenserDriver).
  2. Call a method in resource dispenser whose implementation calls IHolder::Close.
  3. IHolder::Close destroys any remaining inventory by calling back to resource dispenser's DestroyResource.
  4. IHolder::Close calls DispMan to remove this holder from the holder list. (If there are now no holders left, the DispMan object deletes itself.)
  5. IHolder::Close releases its reference to resource dispenser's IDispenserDriver. Note that this is the reason you need a reference in step 1; otherwise, the resource dispenser would delete itself prematurely before the subsequent steps can be completed.
  6. IHolder::Close returns to resource dispenser.
  7. The resource dispenser calls IHolder::Release. The holder now deletes itself.
  8. The method called in step 2 now returns.
  9. Release your final reference to the resource dispenser, which now deletes itself.