The Labs \ Source Viewer \ SSCLI \ System.Threading \ AbandonedMutexException

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. //
  16. // AbandonedMutexException
  17. // Thrown when a wait completes because one or more mutexes was abandoned.
  18. // AbandonedMutexs indicate serious error in user code or machine state.
  19. ////////////////////////////////////////////////////////////////////////////////
  20. namespace System.Threading
  21. {
  22.    
  23.     using System;
  24.     using System.Runtime.Serialization;
  25.     using System.Threading;
  26.     using System.Runtime.InteropServices;
  27.    
  28.     [Serializable()]
  29.     [ComVisibleAttribute(false)]
  30.     public class AbandonedMutexException : SystemException
  31.     {
  32.        
  33.         private int m_MutexIndex = -1;
  34.         private Mutex m_Mutex = null;
  35.        
  36.         public AbandonedMutexException() : base(Environment.GetResourceString("Threading.AbandonedMutexException"))
  37.         {
  38.             SetErrorCode(__HResults.COR_E_ABANDONEDMUTEX);
  39.         }
  40.        
  41.         public AbandonedMutexException(string message) : base(message)
  42.         {
  43.             SetErrorCode(__HResults.COR_E_ABANDONEDMUTEX);
  44.         }
  45.        
  46.         public AbandonedMutexException(string message, Exception inner) : base(message, inner)
  47.         {
  48.             SetErrorCode(__HResults.COR_E_ABANDONEDMUTEX);
  49.         }
  50.        
  51.         public AbandonedMutexException(int location, WaitHandle handle) : base(Environment.GetResourceString("Threading.AbandonedMutexException"))
  52.         {
  53.             SetErrorCode(__HResults.COR_E_ABANDONEDMUTEX);
  54.             SetupException(location, handle);
  55.         }
  56.        
  57.         public AbandonedMutexException(string message, int location, WaitHandle handle) : base(message)
  58.         {
  59.             SetErrorCode(__HResults.COR_E_ABANDONEDMUTEX);
  60.             SetupException(location, handle);
  61.         }
  62.        
  63.         public AbandonedMutexException(string message, Exception inner, int location, WaitHandle handle) : base(message, inner)
  64.         {
  65.             SetErrorCode(__HResults.COR_E_ABANDONEDMUTEX);
  66.             SetupException(location, handle);
  67.         }
  68.        
  69.         private void SetupException(int location, WaitHandle handle)
  70.         {
  71.             m_MutexIndex = location;
  72.             if (handle != null)
  73.                 m_Mutex = handle as Mutex;
  74.         }
  75.        
  76.         protected AbandonedMutexException(SerializationInfo info, StreamingContext context) : base(info, context)
  77.         {
  78.         }
  79.        
  80.         public Mutex Mutex {
  81.             get { return m_Mutex; }
  82.         }
  83.        
  84.         public int MutexIndex {
  85.             get { return m_MutexIndex; }
  86.         }
  87.        
  88.     }
  89. }

Developer Fusion