Removed:
branches/5.2/MySql.Data/Provider/Source/cf/Semaphore.cs
Log:
removing unused semaphore class
Deleted: branches/5.2/MySql.Data/Provider/Source/cf/Semaphore.cs
===================================================================
--- branches/5.2/MySql.Data/Provider/Source/cf/Semaphore.cs 2008-05-07 14:26:55 UTC (rev 1284)
+++ branches/5.2/MySql.Data/Provider/Source/cf/Semaphore.cs 2008-05-07 14:27:39 UTC (rev 1285)
@@ -1,73 +0,0 @@
-// Copyright (C) 2004-2007 MySQL AB
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License version 2 as published by
-// the Free Software Foundation
-//
-// There are special exceptions to the terms and conditions of the GPL
-// as it is applied to this software. View the full text of the
-// exception in file EXCEPTIONS in the directory of this software
-// distribution.
-//
-// This program 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 this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-using System;
-using System.Threading;
-using System.Runtime.InteropServices;
-
-namespace MySql.Data.Common
-{
- internal class Semaphore : WaitHandle
- {
- public Semaphore(int initialCount, int maximumCount)
- {
- IntPtr handle = CreateSemaphore(IntPtr.Zero, initialCount,
- maximumCount, null);
- if (handle.Equals(IntPtr.Zero))
- {
- throw new Exception("Unable to create semaphore");
- }
- base.Handle = handle;
- }
-
- public int Release()
- {
- IntPtr previous = IntPtr.Zero;
- if (!ReleaseSemaphore(base.Handle, 1, previous))
- throw new Exception("Unable to release semaphore");
- return previous.ToInt32();
- }
-
- public override bool WaitOne(int millisecondsTimeout, bool exitContext)
- {
- if ((millisecondsTimeout < 0) && (millisecondsTimeout != -1))
- throw new ArgumentOutOfRangeException("millisecondsTimeout");
-
- if (exitContext)
- throw new ArgumentException(null, "exitContext");
-
- int result = WaitForSingleObject(Handle, millisecondsTimeout);
- if (0 == result) return true;
- return false;
- }
-
- [DllImport("coredll")]
- static extern bool ReleaseSemaphore(IntPtr hSemaphore,
- int lReleaseCount, IntPtr lpPreviousCount);
-
- [DllImport("coredll", SetLastError = true)]
- private static extern IntPtr CreateSemaphore(
- IntPtr securityAttributes, int initialCount,
- int maximumCount, string name);
-
- [DllImport("coredll", SetLastError = true)]
- private static extern int WaitForSingleObject(IntPtr handle, int millis);
- }
-}
| Thread |
|---|
| • Connector/NET commit: r1285 - branches/5.2/MySql.Data/Provider/Source/cf | rburnett | 7 May |