blob: f0926bf023a9a3af9554e5becdb185916bead832 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
//
// System.Threading.Mutex.cs
//
// Author:
//
// Dick Porter (dick@ximian.com)
// Veronica De Santis (veron78@interfree.it)
//
// (C) Ximian, Inc. http://www.ximian.com
//
using System;
using System.Runtime.CompilerServices;
namespace System.Threading
{
public sealed class Mutex : WaitHandle
{
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern IntPtr CreateMutex_internal(
bool initiallyOwned,
string name);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern void ReleaseMutex_internal(IntPtr handle);
public Mutex() {
os_handle=CreateMutex_internal(false,null);
}
public Mutex(bool initiallyOwned) {
os_handle=CreateMutex_internal(initiallyOwned,null);
}
public Mutex(bool initiallyOwned, string name) {
os_handle=CreateMutex_internal(initiallyOwned,name);
}
public Mutex(bool initiallyOwned, string name, out bool gotOwnership) {
os_handle=CreateMutex_internal(initiallyOwned,name);
gotOwnership=false;
}
public void ReleaseMutex() {
ReleaseMutex_internal(os_handle);
}
}
}
|