source: trunk/Include/Classes/System/Threading/Mutex.ab@ 419

Last change on this file since 419 was 419, checked in by NoWest, 16 years ago

この際なのでWaitHandle系を全部実装

File size: 1.5 KB
Line 
1' Classes/System/Threading/Mutex.ab
2
3#ifndef __SYSTEM_THREADING_MUTEX_AB__
4#define __SYSTEM_THREADING_MUTEX_AB__
5
6Namespace System
7Namespace Threading
8
9Class Mutex
10 Inherits System.Threading.WaitHandle
11
12Public
13 Sub Mutex()
14 This.Handle(CreateMutex(NULL,FALSE,NULL))
15 End Sub
16 Sub Mutex(initiallyOwned As Boolean)
17 This.Handle(CreateMutex(NULL,initiallyOwned As BOOL,NULL))
18 End Sub
19 Sub Mutex(initiallyOwned As Boolean, name As String)
20 This.Handle(CreateMutex(NULL,initiallyOwned As BOOL,ToTCStr(name)))
21 End Sub
22 Sub Mutex(initiallyOwned As Boolean, name As String, ByRef createdNew As Boolean)
23 This.Handle(CreateMutex(NULL,initiallyOwned As BOOL,ToTCStr(name)))
24 If ERROR_ALREADY_EXISTS=GetLastError() Then createdNew=False Else createdNew=True
25 'Throw UnauthorizedAccessException
26 'Throw IOException
27 'Throw ApplicationException
28 'Throw ArgumentException
29 End Sub
30/* Sub Mutex(Boolean, String, Boolean, MutexSecurity)
31 TODO
32 End Sub*/
33
34 Static Function OpenExisting (name As String) As Mutex
35 This.Handle(OpenMutex(MUTEX_ALL_ACCESS,FALSE,ToTCStr(name)))
36 'Throw ArgumentException
37 'Throw ArgumentNullException
38 'Throw WaitHandleCannotBeOpenedException
39 'Throw IOException
40 'Throw UnauthorizedAccessException
41 End Function
42
43/* Static Function OpenExisting (String, MutexRights) As Mutex
44 TODO
45 End Function*/
46
47 Sub Release()
48 If ReleaseMutex(This.Handle()) = 0 Then
49 'Throw ApplicationException
50 End If
51 End Sub
52
53End Class
54
55End Namespace 'Threading
56End Namespace 'System
57
58#endif
Note: See TracBrowser for help on using the repository browser.