ReaderWriterLock コンストラクター

定義

ReaderWriterLock クラスの新しいインスタンスを初期化します。

public:
 ReaderWriterLock();
public ReaderWriterLock ();
Public Sub New ()

次のコード例は、ReaderWriterLock クラスの新しいインスタンスを作成する方法を示しています。

このコードは、クラスに提供されるより大きな例の ReaderWriterLock 一部です。

// The complete code is located in the ReaderWriterLock
// class topic.
using namespace System;
using namespace System::Threading;
public ref class Test
{
public:

   // Declaring the ReaderWriterLock at the class level
   // makes it visible to all threads.
   static ReaderWriterLock^ rwl = gcnew ReaderWriterLock;

   // For this example, the shared resource protected by the
   // ReaderWriterLock is just an integer.
   static int resource = 0;
// The complete code is located in the ReaderWriterLock class topic.
using System;
using System.Threading;

public class Example
{
   static ReaderWriterLock rwl = new ReaderWriterLock();
   // Define the shared resource protected by the ReaderWriterLock.
   static int resource = 0;
' The complete code is located in the ReaderWriterLock class topic.
Imports System.Threading

Public Module Example
   Private rwl As New ReaderWriterLock()
   ' Define the shared resource protected by the ReaderWriterLock.
   Private resource As Integer = 0
};
}
End Module

適用対象

こちらもご覧ください