다음을 통해 공유


SynchronizationAttribute 클래스

정의

현재 컨텍스트 및 동일한 인스턴스를 공유하는 모든 컨텍스트에 동기화 도메인을 적용합니다.

public ref class SynchronizationAttribute : System::Runtime::Remoting::Contexts::ContextAttribute, System::Runtime::Remoting::Contexts::IContributeClientContextSink, System::Runtime::Remoting::Contexts::IContributeServerContextSink
[System.AttributeUsage(System.AttributeTargets.Class)]
[System.Serializable]
public class SynchronizationAttribute : System.Runtime.Remoting.Contexts.ContextAttribute, System.Runtime.Remoting.Contexts.IContributeClientContextSink, System.Runtime.Remoting.Contexts.IContributeServerContextSink
[System.AttributeUsage(System.AttributeTargets.Class)]
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public class SynchronizationAttribute : System.Runtime.Remoting.Contexts.ContextAttribute, System.Runtime.Remoting.Contexts.IContributeClientContextSink, System.Runtime.Remoting.Contexts.IContributeServerContextSink
[System.AttributeUsage(System.AttributeTargets.Class)]
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Security.SecurityCritical]
public class SynchronizationAttribute : System.Runtime.Remoting.Contexts.ContextAttribute, System.Runtime.Remoting.Contexts.IContributeClientContextSink, System.Runtime.Remoting.Contexts.IContributeServerContextSink
[<System.AttributeUsage(System.AttributeTargets.Class)>]
[<System.Serializable>]
type SynchronizationAttribute = class
    inherit ContextAttribute
    interface IContributeServerContextSink
    interface IContributeClientContextSink
[<System.AttributeUsage(System.AttributeTargets.Class)>]
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type SynchronizationAttribute = class
    inherit ContextAttribute
    interface IContributeServerContextSink
    interface IContributeClientContextSink
[<System.AttributeUsage(System.AttributeTargets.Class)>]
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Security.SecurityCritical>]
type SynchronizationAttribute = class
    inherit ContextAttribute
    interface IContributeServerContextSink
    interface IContributeClientContextSink
Public Class SynchronizationAttribute
Inherits ContextAttribute
Implements IContributeClientContextSink, IContributeServerContextSink
상속
SynchronizationAttribute
특성
구현

예제

다음 코드 예제에서는 .의 사용을 보여 줍니다 SynchronizationAttribute. 전체 예제 코드는 클래스의 예제를 AsyncResult 참조하세요.

// Context-bound type with the Synchronization context attribute.

[Synchronization]
public ref class SampleSynchronized: public ContextBoundObject
{
public:

   // A method that does some work, and returns the square of the given number.
   int Square( int i )
   {
      Console::Write( "The hash of the thread executing " );
      Console::WriteLine( "SampleSynchronized::Square is: {0}", Thread::CurrentThread->GetHashCode() );
      return i * i;
   }

};
// Context-bound type with the Synchronization context attribute.
[Synchronization()]
public class SampleSynchronized : ContextBoundObject {

    // A method that does some work, and returns the square of the given number.
    public int Square(int i)  {

        Console.Write("The hash of the thread executing ");
        Console.WriteLine("SampleSynchronized.Square is: {0}",
                             Thread.CurrentThread.GetHashCode());
        return i*i;
    }
}
' Context-bound type with the Synchronization context attribute.
<Synchronization()> Public Class SampleSynchronized
   Inherits ContextBoundObject
   
   ' A method that does some work, and returns the square of the given number.
   Public Function Square(i As Integer) As Integer
      
      Console.Write("The hash of the thread executing ")
      Console.WriteLine("SampleSynchronized.Square is: {0}", Thread.CurrentThread.GetHashCode())
      Return i * i
   End Function 

End Class

설명

이 특성이 개체에 적용되면 이 속성의 인스턴스를 공유하는 모든 컨텍스트에서 하나의 스레드만 실행할 수 있습니다. 이 작업은 각 컨텍스트에 대해 들어오는 호출을 가로채고 직렬화하는 싱크를 제공하여 수행됩니다. 속성이 다시 입력하도록 표시되면 설명선도 가로채집니다. 설명선 가로채기를 사용하면 대기 중인 다른 스레드가 최대 처리량을 위해 동기화 도메인에 들어갈 수 있습니다.

메모

SynchronizationAttribute 라는 두 개의 클래스가 있습니다. 하나는 System.Runtime.Remoting.Contexts 네임스페이스에 있고, 다른 하나는 System.EnterpriseServices 네임스페이스에 있습니다. 클래스는 System.EnterpriseServices.SynchronizationAttribute 동기 호출만 지원하며 서비스되는 구성 요소에서만 사용할 수 있습니다. System.Runtime.Remoting.Contexts.SynchronizationAttribute 동기 및 비동기 호출을 모두 지원하며 컨텍스트 바인딩된 개체에서만 사용할 수 있습니다. (컨텍스트 바인딩된 개체에 대한 자세한 내용은 클래스를 ContextBoundObject 참조하세요.)

메모

이 클래스는 클래스 수준에서 링크 요청 및 상속 요청을 만듭니다. 직접 호출자 또는 파생 클래스에 인프라 권한이 없는 경우 A SecurityException 가 throw됩니다. 보안 요구 사항에 대한 자세한 내용은 링크 요구를 참조하세요.

생성자

Name Description
SynchronizationAttribute()

기본값을 사용하여 클래스의 새 인스턴스를 SynchronizationAttribute 초기화합니다.

SynchronizationAttribute(Boolean)

재진입이 필요한지 여부를 나타내는 부울 값을 사용하여 클래스의 SynchronizationAttribute 새 인스턴스를 초기화합니다.

SynchronizationAttribute(Int32, Boolean)

이 특성이 적용되는 개체의 SynchronizationAttribute 동작을 나타내는 플래그와 재진입이 필요한지 여부를 나타내는 부울 값을 사용하여 클래스의 새 인스턴스를 초기화합니다.

SynchronizationAttribute(Int32)

이 특성이 적용되는 개체의 SynchronizationAttribute 동작을 나타내는 플래그를 사용하여 클래스의 새 인스턴스를 초기화합니다.

필드

Name Description
AttributeName

이 API는 제품 인프라를 지원하며 코드에서 직접 사용되지 않습니다.

컨텍스트 특성의 이름을 나타냅니다.

(다음에서 상속됨 ContextAttribute)
NOT_SUPPORTED

동기화가 있는 컨텍스트에서 이 특성이 적용되는 클래스를 만들 수 없음을 나타냅니다. 이 필드는 상수입니다.

REQUIRED

동기화가 있는 컨텍스트에서 이 특성이 적용되는 클래스를 만들어야 임을 나타냅니다. 이 필드는 상수입니다.

REQUIRES_NEW

이 특성이 적용되는 클래스가 매번 동기화 속성의 새 인스턴스가 있는 컨텍스트에서 만들어야 임을 나타냅니다. 이 필드는 상수입니다.

SUPPORTED

이 특성이 적용되는 클래스가 컨텍스트에 동기화가 있는지 여부에 따라 달라지지 않음을 나타냅니다. 이 필드는 상수입니다.

속성

Name Description
IsReEntrant

재진입이 필요한지 여부를 나타내는 부울 값을 가져오거나 설정합니다.

Locked

이 인스턴스 SynchronizationAttribute 의 구현이 잠겨 있는지 여부를 Context 나타내는 부울 값을 가져오거나 설정합니다.

Name

이 API는 제품 인프라를 지원하며 코드에서 직접 사용되지 않습니다.

컨텍스트 특성의 이름을 가져옵니다.

(다음에서 상속됨 ContextAttribute)
TypeId

파생 클래스에서 구현되는 경우 이 Attribute대한 고유 식별자를 가져옵니다.

(다음에서 상속됨 Attribute)

메서드

Name Description
Equals(Object)

이 API는 제품 인프라를 지원하며 코드에서 직접 사용되지 않습니다.

이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 부울 값을 반환합니다.

(다음에서 상속됨 ContextAttribute)
Freeze(Context)

이 API는 제품 인프라를 지원하며 코드에서 직접 사용되지 않습니다.

컨텍스트가 고정되면 호출됩니다.

(다음에서 상속됨 ContextAttribute)
GetClientContextSink(IMessageSink)

CallOut 싱크를 만들고 원격 호출의 클라이언트 끝에 있는 컨텍스트 경계에서 제공된 싱크 체인 앞에 연결합니다.

GetHashCode()

이 API는 제품 인프라를 지원하며 코드에서 직접 사용되지 않습니다.

이 인스턴스에 대한 해시 코드를 반환합니다 ContextAttribute.

(다음에서 상속됨 ContextAttribute)
GetPropertiesForNewContext(IConstructionCallMessage)

지정한 에 Synchronized 컨텍스트 속성을 추가합니다 IConstructionCallMessage.

GetServerContextSink(IMessageSink)

동기화된 디스패치 싱크를 만들고 원격 호출의 서버 끝에 있는 컨텍스트 경계에 제공된 싱크 체인 앞에 연결합니다.

GetType()

현재 인스턴스의 Type 가져옵니다.

(다음에서 상속됨 Object)
IsContextOK(Context, IConstructionCallMessage)

컨텍스트 매개 변수가 컨텍스트 특성의 요구 사항을 충족하는지 여부를 나타내는 부울 값을 반환합니다.

IsDefaultAttribute()

파생 클래스에서 재정의되는 경우 이 인스턴스의 값이 파생 클래스의 기본값인지 여부를 나타냅니다.

(다음에서 상속됨 Attribute)
IsNewContextOK(Context)

이 API는 제품 인프라를 지원하며 코드에서 직접 사용되지 않습니다.

컨텍스트 속성이 새 컨텍스트와 호환되는지 여부를 나타내는 부울 값을 반환합니다.

(다음에서 상속됨 ContextAttribute)
Match(Object)

파생 클래스에서 재정의되는 경우 이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
MemberwiseClone()

현재 Object단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

명시적 인터페이스 구현

Name Description
_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

이름 집합을 해당하는 디스패치 식별자 집합에 매핑합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

인터페이스의 형식 정보를 가져오는 데 사용할 수 있는 개체의 형식 정보를 검색합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

개체에서 제공하는 형식 정보 인터페이스의 수를 검색합니다(0 또는 1).

(다음에서 상속됨 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

개체에 의해 노출되는 속성 및 메서드에 대한 액세스를 제공합니다.

(다음에서 상속됨 Attribute)

적용 대상