System.LocalDataStoreMgr.FreeDataSlot C# (CSharp) Method

FreeDataSlot() private method

private FreeDataSlot ( int slot ) : void
slot int
return void
    	internal void FreeDataSlot(int slot)
    	{
            bool tookLock = false;
            RuntimeHelpers.PrepareConstrainedRegions();
            try {
                Monitor.ReliableEnter(this, ref tookLock);
        		// Go thru all the managed stores and set the data on the specified slot to 0.
        		for (int i=0; i < m_ManagedLocalDataStores.Count; i++)
        		{
        			((LocalDataStore)m_ManagedLocalDataStores[i]).SetDataInternal(
        			                                                  slot, 
        			                                                  null, 
        			                                                  false);
                }        			                                                    
    			        		
        		// Mark the slot as being no longer occupied. 
        		m_SlotInfoTable[slot] = 0;
				if (slot < m_FirstAvailableSlot)
					m_FirstAvailableSlot = slot;
        	}
            finally {
                if (tookLock)
                    Monitor.Exit(this);
            }
	    }

Usage Example

Beispiel #1
0
 /// <summary>Ensures that resources are freed and other cleanup operations are performed when the garbage collector reclaims the <see cref="T:System.LocalDataStoreSlot" /> object. </summary>
 // Token: 0x06000FE1 RID: 4065 RVA: 0x0003054C File Offset: 0x0002E74C
 protected override void Finalize()
 {
     try
     {
         LocalDataStoreMgr mgr = this.m_mgr;
         if (mgr != null)
         {
             int slot = this.m_slot;
             this.m_slot = -1;
             mgr.FreeDataSlot(slot, this.m_cookie);
         }
     }
     finally
     {
         base.Finalize();
     }
 }