GMap.NET.Core/GMap.NET.Internals/FastResourceLock.cs

(开头部分) 31KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/*
 * Process Hacker - 
 *   fast resource lock
 * 
 * Copyright (C) 2009 wj32
 * 
 * This file is part of Process Hacker.
 * 
 * Process Hacker is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Process Hacker is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Process Hacker.  If not, see <http://www.gnu.org/licenses/>.
 */

#define DEFER_EVENT_CREATION
//#define ENABLE_STATISTICS
//#define RIGOROUS_CHECKS

using System;
using System.Runtime.InteropServices;
using System.Security;
using System.Threading;

namespace GMap.NET.Internals
{
#if !MONO && !PocketPC
   /// <summary>
   /// Provides a fast resource (reader-writer) lock.
   /// </summary>
   /// <remarks>
   /// There are three types of acquire methods in this lock:
   /// 
   /// Normal methods (AcquireExclusive, AcquireShared) are preferred 
   /// for general purpose use.
   /// Busy wait methods (SpinAcquireExclusive, SpinAcquireShared) are 
   /// preferred if very little time is spent while the lock is acquired. 
   /// However, these do not give exclusive acquires precedence over 
   /// shared acquires.
   /// Try methods (TryAcquireExclusive, TryAcquireShared) can be used to 
   /// quickly test if the lock is available.
   /// 
   /// Note that all three types of functions can be used concurrently 
   /// in the same class instance.
   /// </remarks>
   internal sealed class FastResourceLock : IDisposable
   {
      // Details
      //
      // Resource lock value width: 32 bits.
      // Lock owned (either exclusive or shared): L (1 bit).
      // Exclusive waking: W (1 bit).
      // Shared owners count: SC (10 bits).
后面还有 916 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。