다음을 통해 공유


IHttpStoredContext::CleanupStoredContext 메서드

저장된 컨텍스트를 정리합니다.

구문

virtual VOID CleanupStoredContext(  
   VOID  
) = 0;  

매개 변수

이 메서드는 매개 변수를 사용하지 않습니다.

설명

이 메서드의 동작은 구현에 따라 달라집니다. 다음 정보를 지침으로 사용해야 하지만 모든 시나리오에서 올바르지 않을 수 있습니다.

  • 일부 구현은 메서드 중에 CleanupStoredContext 빈 작업을 수행합니다.

  • 일부 구현은 현재 IHttpStoredContext 포인터를 호출 delete``this 합니다.

  • 일부 구현에서는 내부 참조 계산을 사용하고 에 대한 각 호출 CleanupStoredContext중에 내부 참조 수를 줄입니다. 이러한 구현자는 해당 참조 수가 0으로 전환되면 즉시 현재 IHttpStoredContext 를 호출 delete``this 합니다.

구현자에 대한 참고 사항

IHttpStoredContext포인터를 삭제하기 위해 가장 구체적인 클래스로 다운캐스트하면 안 되므로 구현자는 또는 private``virtual 소멸자를 IHttpStoredContext 만들어야 protected 합니다. 대신 이러한 구현자의 삭제는 내부적으로 각 포인터에 의해 제어되고 에 대한 호출 CleanupStoredContext중에 처리되어야 합니다.

호출자 참고 사항

일부 구현은 CleanupStoredContext 가 호출될 때 CleanupStoredContext 를 호출하기 때문에 포인터에서 IHttpStoredContext 메서드를 한 번만 호출 delete``this 해야 합니다. 대부분의 IHttpStoredContext 포인터에서 두 번 이상 호출 CleanupStoredContext 하면 액세스 위반 예외가 발생하거나 메모리에 데이터가 손상됩니다.

예제

다음 코드 예제에서는 라는 MyStoredContext 클래스를 IHttpStoredContext 만들고 내부적으로 포인터 삭제를 MyStoredContext 제어하는 방법을 보여 줍니다. MyStoredContext 는 소멸자 private 만 구현하고 메서드가 호출되면 소멸자를 CleanupStoredContext 호출합니다.

// The MyStoredContext class implements the IHttpStoredContext  
// interface and demonstrates one possible solution for  
// implementing the CleanupStoredContext method.  
class MyStoredContext : public IHttpStoredContext  
{  
public:  
    // The MyStoredContext method is the public   
    // constructor for the MyStoredContext class.  
    MyStoredContext()  
    {  
  
    }  
  
    // The CleanupStoredContext method must be implemented  
    // by non-abstract classes that implement the   
    // IHttpStoredContext interface. This method   
    // calls delete this.  
    virtual void CleanupStoredContext(VOID)  
    {  
        delete this;  
    }  
  
private:  
    // The MyStoredContext method is the private virtual  
    // destructor for the MyStoredContext class.  
    virtual ~MyStoredContext()  
    {  
  
    }  
};  

요구 사항

형식 Description
클라이언트 - Windows Vista의 IIS 7.0
- Windows 7의 IIS 7.5
- Windows 8의 IIS 8.0
- WINDOWS 10 IIS 10.0
서버 - Windows Server 2008의 IIS 7.0
- Windows Server 2008 R2의 IIS 7.5
- Windows Server 2012의 IIS 8.0
- Windows Server 2012 R2의 IIS 8.5
- WINDOWS SERVER 2016 IIS 10.0
제품 - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
- IIS Express 7.5, IIS Express 8.0, IIS Express 10.0
헤더 Httpserv.h

참고 항목

IHttpStoredContext 인터페이스