ReaderWriterLock 构造函数
初始化 ReaderWriterLock 类的新实例。
**命名空间:**System.Threading
**程序集:**mscorlib(在 mscorlib.dll 中)
语法
声明
Public Sub New
用法
Dim instance As New ReaderWriterLock
public ReaderWriterLock ()
public:
ReaderWriterLock ()
public ReaderWriterLock ()
public function ReaderWriterLock ()
示例
' The complete code is located in the ReaderWriterLock
' class topic.
Imports System
Imports System.Threading
Imports Microsoft.VisualBasic
Public Class Test
' Declaring the ReaderWriterLock at the class level
' makes it visible to all threads.
Private Shared rwl As New ReaderWriterLock()
' For this example, the shared resource protected by the
' ReaderWriterLock is just an integer.
Private Shared resource As Integer = 0
...
End Class 'Test
// The complete code is located in the ReaderWriterLock
// class topic.
using System;
using System.Threading;
public class Test
{
// Declaring the ReaderWriterLock at the class level
// makes it visible to all threads.
static ReaderWriterLock rwl = new 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 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.
import System.*;
import System.Threading.*;
import System.Threading.Thread;
public class Test
{
// Declaring the ReaderWriterLock at the class level
// makes it visible to all threads.
private static ReaderWriterLock rwl = new ReaderWriterLock();
// For this example, the shared resource protected by the
// ReaderWriterLock is just an integer.
private static int resource = 0;
...
}
平台
Windows 98、Windows 2000 SP4、Windows Millennium Edition、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
版本信息
.NET Framework
受以下版本支持:2.0、1.1、1.0
请参见
参考
ReaderWriterLock 类
ReaderWriterLock 成员
System.Threading 命名空间