Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDick Porter <dick@acm.org>2005-12-23 23:29:06 +0300
committerDick Porter <dick@acm.org>2005-12-23 23:29:06 +0300
commit8265935e1be8e419424e27753aa822a3062c8127 (patch)
tree386699a4e1f06e6b9e8eea0751e10e792f3f7b36 /mcs/class/System
parentceb3a50eb605a62156f6a0e8d82e5ff1e9d2d51f (diff)
2005-12-23 Dick Porter <dick@ximian.com>
* EventWaitHandle.cs: * Mutex.cs: Implement OpenExisting * NativeEventCalls.cs: Add OpenEvent icall for OpenExisting in 2.0. Add a "created" boolean out parameter to CreateEvent icall. * ManualResetEvent.cs: * AutoResetEvent.cs: Update CreateEvent icall signature (now has "created" boolean out parameter.) 2005-12-23 Dick Porter <dick@ximian.com> * Semaphore.cs: Implement OpenExisting 2005-12-23 Dick Porter <dick@ximian.com> * MutexRights.cs: New for 2.0 profile 2005-12-23 Dick Porter <dick@ximian.com> * SemaphoreRights.cs: Make the [Flags] enum more obvious 2005-12-23 Dick Porter <dick@ximian.com> * SemaphoreTest.cs: Enable another test 2005-12-23 Dick Porter <dick@ximian.com> * corlib.dll.sources: Added System.Security.AccessControl.MutexRights svn path=/trunk/mcs/; revision=54801
Diffstat (limited to 'mcs/class/System')
-rw-r--r--mcs/class/System/System.Security.AccessControl/ChangeLog4
-rw-r--r--mcs/class/System/System.Security.AccessControl/SemaphoreRights.cs14
-rw-r--r--mcs/class/System/System.Threading/ChangeLog4
-rw-r--r--mcs/class/System/System.Threading/Semaphore.cs25
-rw-r--r--mcs/class/System/Test/System.Threading/ChangeLog4
-rw-r--r--mcs/class/System/Test/System.Threading/SemaphoreTest.cs1
6 files changed, 42 insertions, 10 deletions
diff --git a/mcs/class/System/System.Security.AccessControl/ChangeLog b/mcs/class/System/System.Security.AccessControl/ChangeLog
index a6210881364..d17e2d555c2 100644
--- a/mcs/class/System/System.Security.AccessControl/ChangeLog
+++ b/mcs/class/System/System.Security.AccessControl/ChangeLog
@@ -1,3 +1,7 @@
+2005-12-23 Dick Porter <dick@ximian.com>
+
+ * SemaphoreRights.cs: Make the [Flags] enum more obvious
+
2005-11-17 Sebastien Pouliot <sebastien@ximian.com>
* SemaphoreRights.cs: New (2.0). Enum of all the rights applicable to
diff --git a/mcs/class/System/System.Security.AccessControl/SemaphoreRights.cs b/mcs/class/System/System.Security.AccessControl/SemaphoreRights.cs
index 79d77763859..f3163c99581 100644
--- a/mcs/class/System/System.Security.AccessControl/SemaphoreRights.cs
+++ b/mcs/class/System/System.Security.AccessControl/SemaphoreRights.cs
@@ -35,13 +35,13 @@ namespace System.Security.AccessControl {
[ComVisible (false)]
[Flags]
public enum SemaphoreRights {
- Modify = 2,
- Delete = 65536,
- ReadPermissions = 131072,
- ChangePermissions = 262144,
- TakeOwnership = 524288,
- Synchronize = 1048576,
- FullControl = 2031619
+ Modify = 0x000002,
+ Delete = 0x010000,
+ ReadPermissions = 0x020000,
+ ChangePermissions = 0x040000,
+ TakeOwnership = 0x080000,
+ Synchronize = 0x100000,
+ FullControl = 0x1F0003 /* not 0x1F0002 according to corcompare */
}
}
diff --git a/mcs/class/System/System.Threading/ChangeLog b/mcs/class/System/System.Threading/ChangeLog
index 3b6cad51cb9..a7485029884 100644
--- a/mcs/class/System/System.Threading/ChangeLog
+++ b/mcs/class/System/System.Threading/ChangeLog
@@ -1,3 +1,7 @@
+2005-12-23 Dick Porter <dick@ximian.com>
+
+ * Semaphore.cs: Implement OpenExisting
+
2005-11-26 Dick Porter <dick@ximian.com>
* Semaphore.cs: Implemented with icalls
diff --git a/mcs/class/System/System.Threading/Semaphore.cs b/mcs/class/System/System.Threading/Semaphore.cs
index 02f84417748..c192d368275 100644
--- a/mcs/class/System/System.Threading/Semaphore.cs
+++ b/mcs/class/System/System.Threading/Semaphore.cs
@@ -32,6 +32,7 @@ using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using System.Security.AccessControl;
using System.Runtime.CompilerServices;
+using System.IO;
namespace System.Threading {
@@ -47,6 +48,14 @@ namespace System.Threading {
private static extern int ReleaseSemaphore_internal (
IntPtr handle, int releaseCount, out bool fail);
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private static extern IntPtr OpenSemaphore_internal (string name, SemaphoreRights rights, out MonoIOError error);
+
+ private Semaphore (IntPtr handle)
+ {
+ Handle = handle;
+ }
+
public Semaphore (int initialCount, int maximumCount)
: this (initialCount, maximumCount, null)
{
@@ -137,7 +146,6 @@ namespace System.Threading {
return OpenExisting (name, SemaphoreRights.Synchronize | SemaphoreRights.Modify);
}
- [MonoTODO]
public static Semaphore OpenExisting (string name, SemaphoreRights rights)
{
if (name == null)
@@ -145,7 +153,20 @@ namespace System.Threading {
if ((name.Length ==0) || (name.Length > 260))
throw new ArgumentException ("name", Locale.GetText ("Invalid length [1-260]."));
- throw new NotImplementedException ();
+ MonoIOError error;
+ IntPtr handle = OpenSemaphore_internal (name, rights,
+ out error);
+ if (handle == (IntPtr)null) {
+ if (error == MonoIOError.ERROR_FILE_NOT_FOUND) {
+ throw new WaitHandleCannotBeOpenedException (Locale.GetText ("Named Semaphore handle does not exist: ") + name);
+ } else if (error == MonoIOError.ERROR_ACCESS_DENIED) {
+ throw new UnauthorizedAccessException ();
+ } else {
+ throw new IOException (Locale.GetText ("Win32 IO error: ") + error.ToString ());
+ }
+ }
+
+ return(new Semaphore (handle));
}
}
}
diff --git a/mcs/class/System/Test/System.Threading/ChangeLog b/mcs/class/System/Test/System.Threading/ChangeLog
index bc781acc19d..2b0cab895bd 100644
--- a/mcs/class/System/Test/System.Threading/ChangeLog
+++ b/mcs/class/System/Test/System.Threading/ChangeLog
@@ -1,3 +1,7 @@
+2005-12-23 Dick Porter <dick@ximian.com>
+
+ * SemaphoreTest.cs: Enable another test
+
2005-12-06 Dick Porter <dick@ximian.com>
* SemaphoreTest.cs: Enable the tests
diff --git a/mcs/class/System/Test/System.Threading/SemaphoreTest.cs b/mcs/class/System/Test/System.Threading/SemaphoreTest.cs
index e21823f80c6..9e5db531fd0 100644
--- a/mcs/class/System/Test/System.Threading/SemaphoreTest.cs
+++ b/mcs/class/System/Test/System.Threading/SemaphoreTest.cs
@@ -212,7 +212,6 @@ namespace MonoTests.System.Threading {
}
[Test]
- [Category ("NotWorking")] // not implemented in Mono
[ExpectedException (typeof (WaitHandleCannotBeOpenedException))]
public void OpenExisting_Unexisting ()
{