source: trunk/ab5.0/ablib/src/Classes/System/Threading/Mutex.ab@ 664

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

#ifndef~#define~#endifを除去

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