• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# System.LocalDataStoreSlot类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.LocalDataStoreSlot的典型用法代码示例。如果您正苦于以下问题:C# LocalDataStoreSlot类的具体用法?C# LocalDataStoreSlot怎么用?C# LocalDataStoreSlot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LocalDataStoreSlot类属于System命名空间,在下文中一共展示了LocalDataStoreSlot类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetData

        /*=========================================================================
        ** Retrieves the value from the specified slot.
        =========================================================================*/
        public Object GetData(LocalDataStoreSlot slot)
        {
            Object o = null;

            // Validate the slot.
            m_Manager.ValidateSlot(slot);

            // Cache the slot index to avoid synchronization issues.
            int slotIdx = slot.Slot;

            if (slotIdx >= 0)
            {
                // Delay expansion of m_DataTable if we can
                if (slotIdx >= m_DataTable.Length)
                    return null;

                // Retrieve the data from the given slot.
                o = m_DataTable[slotIdx];
            }

            // Check if the slot has become invalid.
            if (!slot.IsValid())
                throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_SlotHasBeenFreed"));
            return o;
        }
开发者ID:ArildF,项目名称:masters,代码行数:28,代码来源:_localdatastore.cs


示例2: AllocateDataSlot

 public LocalDataStoreSlot AllocateDataSlot()
 {
     LocalDataStoreSlot slot2;
     bool lockTaken = false;
     RuntimeHelpers.PrepareConstrainedRegions();
     try
     {
         long num4;
         Monitor.Enter(this, ref lockTaken);
         int length = this.m_SlotInfoTable.Length;
         if (this.m_FirstAvailableSlot >= length)
         {
             int num2;
             if (length < 0x200)
             {
                 num2 = length * 2;
             }
             else
             {
                 num2 = length + 0x80;
             }
             bool[] destinationArray = new bool[num2];
             Array.Copy(this.m_SlotInfoTable, destinationArray, length);
             this.m_SlotInfoTable = destinationArray;
             this.m_FirstAvailableSlot = length;
             length = num2;
         }
         int firstAvailableSlot = this.m_FirstAvailableSlot;
         while (true)
         {
             if (!this.m_SlotInfoTable[firstAvailableSlot])
             {
                 break;
             }
             firstAvailableSlot++;
         }
         this.m_SlotInfoTable[firstAvailableSlot] = true;
         this.m_CookieGenerator = (num4 = this.m_CookieGenerator) + 1L;
         LocalDataStoreSlot slot = new LocalDataStoreSlot(this, firstAvailableSlot, num4);
         firstAvailableSlot++;
         while (firstAvailableSlot < length)
         {
             if (this.m_SlotInfoTable[firstAvailableSlot])
             {
                 break;
             }
             firstAvailableSlot++;
         }
         this.m_FirstAvailableSlot = firstAvailableSlot;
         slot2 = slot;
     }
     finally
     {
         if (lockTaken)
         {
             Monitor.Exit(this);
         }
     }
     return slot2;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:60,代码来源:LocalDataStoreMgr.cs


示例3: PopulateElement

		private LocalDataStoreElement PopulateElement(LocalDataStoreSlot slot)
		{
			bool flag = false;
			RuntimeHelpers.PrepareConstrainedRegions();
			LocalDataStoreElement result;
			try
			{
				Monitor.Enter(this.m_Manager, ref flag);
				int slot2 = slot.Slot;
				if (slot2 < 0)
				{
					throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_SlotHasBeenFreed"));
				}
				if (slot2 >= this.m_DataTable.Length)
				{
					int slotTableLength = this.m_Manager.GetSlotTableLength();
					LocalDataStoreElement[] array = new LocalDataStoreElement[slotTableLength];
					Array.Copy(this.m_DataTable, array, this.m_DataTable.Length);
					this.m_DataTable = array;
				}
				if (this.m_DataTable[slot2] == null)
				{
					this.m_DataTable[slot2] = new LocalDataStoreElement(slot.Cookie);
				}
				result = this.m_DataTable[slot2];
			}
			finally
			{
				if (flag)
				{
					Monitor.Exit(this.m_Manager);
				}
			}
			return result;
		}
开发者ID:ChristianWulf,项目名称:CSharpKDMDiscoverer,代码行数:35,代码来源:LocalDataStore.cs


示例4: AllocateDataSlot

 public LocalDataStoreSlot AllocateDataSlot()
 {
     LocalDataStoreSlot slot2;
     bool tookLock = false;
     RuntimeHelpers.PrepareConstrainedRegions();
     try
     {
         LocalDataStoreSlot slot;
         int num3;
         Monitor.ReliableEnter(this, ref tookLock);
         int length = this.m_SlotInfoTable.Length;
         if (this.m_FirstAvailableSlot < length)
         {
             slot = new LocalDataStoreSlot(this, this.m_FirstAvailableSlot);
             this.m_SlotInfoTable[this.m_FirstAvailableSlot] = 1;
             int index = this.m_FirstAvailableSlot + 1;
             while (index < length)
             {
                 if ((this.m_SlotInfoTable[index] & 1) == 0)
                 {
                     break;
                 }
                 index++;
             }
             this.m_FirstAvailableSlot = index;
             return slot;
         }
         if (length < 0x200)
         {
             num3 = length * 2;
         }
         else
         {
             num3 = length + 0x80;
         }
         byte[] destinationArray = new byte[num3];
         Array.Copy(this.m_SlotInfoTable, destinationArray, length);
         this.m_SlotInfoTable = destinationArray;
         slot = new LocalDataStoreSlot(this, length);
         this.m_SlotInfoTable[length] = 1;
         this.m_FirstAvailableSlot = length + 1;
         slot2 = slot;
     }
     finally
     {
         if (tookLock)
         {
             Monitor.Exit(this);
         }
     }
     return slot2;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:52,代码来源:LocalDataStoreMgr.cs


示例5: SetData

		public void SetData(LocalDataStoreSlot slot, object data)
		{
			this.m_Manager.ValidateSlot(slot);
			int slot2 = slot.Slot;
			if (slot2 >= 0)
			{
				LocalDataStoreElement localDataStoreElement = (slot2 < this.m_DataTable.Length) ? this.m_DataTable[slot2] : null;
				if (localDataStoreElement == null)
				{
					localDataStoreElement = this.PopulateElement(slot);
				}
				if (localDataStoreElement.Cookie == slot.Cookie)
				{
					localDataStoreElement.Value = data;
					return;
				}
			}
			throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_SlotHasBeenFreed"));
		}
开发者ID:ChristianWulf,项目名称:CSharpKDMDiscoverer,代码行数:19,代码来源:LocalDataStore.cs


示例6: TestDatastore

		public void TestDatastore ()
		{
			otherCtx = cbo.GetContext ();
			
			slot = Context.AllocateDataSlot ();
			LocalDataStoreSlot namedSlot1 = Context.AllocateNamedDataSlot ("slot1");
			LocalDataStoreSlot namedSlot2 = Context.GetNamedDataSlot ("slot2");
			
			Context.SetData (slot, "data");
			Context.SetData (namedSlot1, "data1");
			Context.SetData (namedSlot2, "data2");
			
			otherCtx.DoCallBack (new CrossContextDelegate (CheckOtherContextDatastore));
			
			Assert.IsTrue (Context.GetData (slot).Equals ("data"), "Wrong data 1");
			Assert.IsTrue (Context.GetData (namedSlot1).Equals ("data1"), "Wrong data 2");
			Assert.IsTrue (Context.GetData (namedSlot2).Equals ("data2"), "Wrong data 3");
			
			try
			{
				namedSlot1 = Context.AllocateNamedDataSlot ("slot1");
				Assert.Fail ("Exception expected");
			}
			catch {}
			
			Context.FreeNamedDataSlot ("slot1");
			Context.FreeNamedDataSlot ("slot2");
			
			try
			{
				namedSlot1 = Context.AllocateNamedDataSlot ("slot1");
			}
			catch 
			{
				Assert.Fail ("Exception not expected");
			}
			
			Context.FreeNamedDataSlot ("slot1");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:39,代码来源:ContextTest.cs


示例7: GetData

		public object GetData(LocalDataStoreSlot slot)
		{
			this.m_Manager.ValidateSlot(slot);
			int slot2 = slot.Slot;
			if (slot2 >= 0)
			{
				if (slot2 >= this.m_DataTable.Length)
				{
					return null;
				}
				LocalDataStoreElement localDataStoreElement = this.m_DataTable[slot2];
				if (localDataStoreElement == null)
				{
					return null;
				}
				if (localDataStoreElement.Cookie == slot.Cookie)
				{
					return localDataStoreElement.Value;
				}
			}
			throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_SlotHasBeenFreed"));
		}
开发者ID:ChristianWulf,项目名称:CSharpKDMDiscoverer,代码行数:22,代码来源:LocalDataStore.cs


示例8: SaveContextToStore

 private static void SaveContextToStore(LocalDataStoreSlot storeSlot, CSContext context)
 {
     Thread.SetData(storeSlot, context);
 }
开发者ID:pcstx,项目名称:OA,代码行数:4,代码来源:CSContext.cs


示例9: ValidateSlot

		public void ValidateSlot(LocalDataStoreSlot slot)
		{
			if (slot == null || slot.Manager != this)
			{
				throw new ArgumentException(Environment.GetResourceString("Argument_ALSInvalidSlot"));
			}
		}
开发者ID:ChristianWulf,项目名称:CSharpKDMDiscoverer,代码行数:7,代码来源:LocalDataStoreMgr.cs


示例10: PopulateElement

        [System.Security.SecuritySafeCritical]  // auto-generated
        private LocalDataStoreElement PopulateElement(LocalDataStoreSlot slot)
        {
            bool tookLock = false;
            RuntimeHelpers.PrepareConstrainedRegions();
            try {
                Monitor.Enter(m_Manager, ref tookLock);

                // Make sure that the slot was not freed in the meantime
                int slotIdx = slot.Slot;
                if (slotIdx < 0)
                    throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_SlotHasBeenFreed"));

                if (slotIdx >= m_DataTable.Length)
                {
                    int capacity = m_Manager.GetSlotTableLength();

                    // Validate that the specified capacity is larger than the current one.
                    Contract.Assert(capacity >= m_DataTable.Length, "LocalDataStore corrupted: capacity >= m_DataTable.Length");

                    // Allocate the new data table.
                    LocalDataStoreElement[] NewDataTable = new LocalDataStoreElement[capacity];

                    // Copy all the objects into the new table.
                    Array.Copy(m_DataTable, NewDataTable, m_DataTable.Length);

                    // Save the new table.
                    m_DataTable = NewDataTable;
                }

                // Validate that there is enough space in the local data store now
                Contract.Assert(slotIdx < m_DataTable.Length, "LocalDataStore corrupted: slotIdx < m_DataTable.Length");

                if (m_DataTable[slotIdx] == null)
                    m_DataTable[slotIdx] = new LocalDataStoreElement(slot.Cookie);

                return m_DataTable[slotIdx];
            }
            finally {
                if (tookLock)
                    Monitor.Exit(m_Manager);
            }
        }
开发者ID:l1183479157,项目名称:coreclr,代码行数:43,代码来源:_LocalDataStore.cs


示例11: SetData

        /*=========================================================================
        ** Sets the data in the specified slot.
        =========================================================================*/
        public void SetData(LocalDataStoreSlot slot, Object data)
        {
            // Validate the slot.
            m_Manager.ValidateSlot(slot);

            // Cache the slot index to avoid synchronization issues.
            int slotIdx = slot.Slot;

            if (slotIdx >= 0)
            {
                LocalDataStoreElement element = (slotIdx < m_DataTable.Length) ? m_DataTable[slotIdx] : null;
                if (element == null)
                {
                    element = PopulateElement(slot);
                }

                // Check that the element is owned by this slot by comparing cookies.
                // This is necesary to avoid resurection race conditions.
                if (element.Cookie == slot.Cookie)
                {
                    // Set the data on the given slot.
                    element.Value = data;
                    return;
                }

                // Fall thru and throw exception
            }

            throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_SlotHasBeenFreed"));
        }
开发者ID:l1183479157,项目名称:coreclr,代码行数:33,代码来源:_LocalDataStore.cs


示例12: SetData

 [System.Security.SecurityCritical]  // auto-generated_required
 public static void SetData(LocalDataStoreSlot slot, Object data)
 {
                 Thread.CurrentContext.MyLocalStore.SetData(slot, data);                    
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:5,代码来源:Context.cs


示例13: GetData

 [System.Security.SecurityCritical]  // auto-generated_required
 public static Object GetData(LocalDataStoreSlot slot)
 {
     return Thread.CurrentContext.MyLocalStore.GetData(slot);              
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:5,代码来源:Context.cs


示例14: SetData

 public static void SetData(LocalDataStoreSlot slot, object data)
 {
     LocalDataStore domainLocalStore = GetDomainLocalStore();
     if (domainLocalStore == null)
     {
         domainLocalStore = LocalDataStoreManager.CreateLocalDataStore();
         SetDomainLocalStore(domainLocalStore);
     }
     domainLocalStore.SetData(slot, data);
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:10,代码来源:Thread.cs


示例15: GetData

        /*=========================================================================
        ** Retrieves the value from the specified slot.
        =========================================================================*/
        public Object GetData(LocalDataStoreSlot slot)
        {
            // Validate the slot.
            m_Manager.ValidateSlot(slot);

            // Cache the slot index to avoid synchronization issues.
            int slotIdx = slot.Slot;

            if (slotIdx >= 0)
            {
                // Delay expansion of m_DataTable if we can
                if (slotIdx >= m_DataTable.Length)
                    return null;         
                
                // Retrieve the data from the given slot.
                LocalDataStoreElement element = m_DataTable[slotIdx];

          //Initially we prepopulate the elements to be null.     
          if (element == null)
              return null;

                // Check that the element is owned by this slot by comparing cookies.
                // This is necesary to avoid resurection race conditions.
                if (element.Cookie == slot.Cookie)
                    return element.Value;

                // Fall thru and throw exception
            }
                
            throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_SlotHasBeenFreed"));
        }
开发者ID:l1183479157,项目名称:coreclr,代码行数:34,代码来源:_LocalDataStore.cs


示例16: AllocateDataSlot

		public LocalDataStoreSlot AllocateDataSlot()
		{
			bool flag = false;
			RuntimeHelpers.PrepareConstrainedRegions();
			LocalDataStoreSlot result;
			try
			{
				Monitor.Enter(this, ref flag);
				int num = this.m_SlotInfoTable.Length;
				if (this.m_FirstAvailableSlot >= num)
				{
					int num2;
					if (num < 512)
					{
						num2 = num * 2;
					}
					else
					{
						num2 = num + 128;
					}
					bool[] array = new bool[num2];
					Array.Copy(this.m_SlotInfoTable, array, num);
					this.m_SlotInfoTable = array;
					this.m_FirstAvailableSlot = num;
					num = num2;
				}
				int num3 = this.m_FirstAvailableSlot;
				while (this.m_SlotInfoTable[num3])
				{
					num3++;
				}
				this.m_SlotInfoTable[num3] = true;
				int arg_9A_1 = num3;
				long cookieGenerator;
				this.m_CookieGenerator = checked((cookieGenerator = this.m_CookieGenerator) + 1L);
				LocalDataStoreSlot localDataStoreSlot = new LocalDataStoreSlot(this, arg_9A_1, cookieGenerator);
				num3++;
				while (num3 < num && !this.m_SlotInfoTable[num3])
				{
					num3++;
				}
				this.m_FirstAvailableSlot = num3;
				result = localDataStoreSlot;
			}
			finally
			{
				if (flag)
				{
					Monitor.Exit(this);
				}
			}
			return result;
		}
开发者ID:ChristianWulf,项目名称:CSharpKDMDiscoverer,代码行数:53,代码来源:LocalDataStoreMgr.cs


示例17: GetData

 public static object GetData(LocalDataStoreSlot slot)
 {
     LocalDataStoreManager.ValidateSlot(slot);
     LocalDataStore domainLocalStore = GetDomainLocalStore();
     if (domainLocalStore == null)
     {
         return null;
     }
     return domainLocalStore.GetData(slot);
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:10,代码来源:Thread.cs


示例18: Repository

 /// <summary>
 /// Static constructor creates a new session factory used by all instances
 /// of this class.
 /// </summary>
 static Repository()
 {
     Configuration cfg = new Configuration();
     cfg.AddAssembly("SFASystem.Domain");
     factory = cfg.BuildSessionFactory();
     mysessions =  Thread.AllocateDataSlot();
 }
开发者ID:tsubik,项目名称:SFASystem,代码行数:11,代码来源:repository.cs


示例19: DatabaseControl

        static DatabaseControl()
        {
            //log4net.Config.XmlConfigurator.Configure();

            AutoMappingConfiguration cfg = new AutoMappingConfiguration();

            System.Reflection.Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies().Where(w => w.FullName.Contains("ComprasColetivas.Domain.Model")).ToArray();

            factory = Fluently.Configure()

                .Database(MsSqlConfiguration.MsSql2008.ConnectionString(Properties.Settings.Default.ConnectionStringSQLServer).ShowSql())
                .Mappings(m =>
                {
                    m.AutoMappings.Add(AutoMap.Assemblies(cfg, assemblies).Conventions.Setup(c =>
                    {
                        c.Add<PrimaryKeyConvention>();
                        c.Add<CustomForeignKeyConvention>();
                        c.Add<DefaultStringLengthConvention>();
                        c.Add<TableConvention>();
                        c.Add<EnumMappingConvention>();

                    })
                                                                                                   );
                    m.AutoMappings.ToList()[0].IncludeBase<Pessoa>();
                    m.AutoMappings.ToList()[0].IncludeBase<Pagamento>();

                }).ExposeConfiguration(BuildSchema).BuildSessionFactory();

            mysessions = Thread.AllocateDataSlot();
        }
开发者ID:hmattoso,项目名称:scc,代码行数:30,代码来源:DatabaseControl.cs


示例20: EventProvider

 public EventProvider(Guid providerGuid)
 {
     this.m_providerId = providerGuid;
     s_returnCodeSlot = Thread.AllocateDataSlot();
     Thread.SetData(s_returnCodeSlot, 0);
     this.EtwRegister();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:EventProvider.cs



注:本文中的System.LocalDataStoreSlot类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# System.Log类代码示例发布时间:2022-05-26
下一篇:
C# System.Local类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap