[419] | 1 | ' Classes/System/Threading/EventWaitHandle.ab
|
---|
[417] | 2 |
|
---|
| 3 | NameSpace System
|
---|
| 4 | NameSpace Threading
|
---|
| 5 |
|
---|
| 6 | Enum EventResetMode
|
---|
| 7 | AutoReset = False
|
---|
| 8 | ManualReset = True
|
---|
| 9 | End Enum
|
---|
| 10 |
|
---|
| 11 | Class EventWaitHandle
|
---|
| 12 | Inherits System.Threading.WaitHandle
|
---|
[599] | 13 | Private
|
---|
| 14 | Sub EventWaitHandle()
|
---|
| 15 | End Sub
|
---|
[417] | 16 | Public
|
---|
| 17 | Sub EventWaitHandle (initialState As Boolean, mode As EventResetMode)
|
---|
[419] | 18 | This.Handle(CreateEvent(NULL,mode As BOOL,initialState As BOOL,NULL))
|
---|
[417] | 19 | End Sub
|
---|
| 20 | Sub EventWaitHandle (initialState As Boolean, mode As EventResetMode, name As String)
|
---|
[419] | 21 | This.Handle(CreateEvent(NULL,mode As BOOL,initialState As BOOL,ToTCStr(name)))
|
---|
[417] | 22 | End Sub
|
---|
| 23 | Sub EventWaitHandle (initialState As Boolean, mode As EventResetMode, name As String, ByRef createdNew As Boolean)
|
---|
[419] | 24 | This.Handle(CreateEvent(NULL,mode As BOOL,initialState As BOOL,ToTCStr(name)))
|
---|
| 25 | If ERROR_ALREADY_EXISTS=GetLastError() Then createdNew=False Else createdNew=True
|
---|
[417] | 26 | End Sub
|
---|
| 27 | /* Sub EventWaitHandle (initialState As Boolean, mode As EventResetMode, name As String, ByRef createdNew As Boolean, EventWaitHandleSecurity)
|
---|
| 28 | TODO
|
---|
| 29 | End Sub*/
|
---|
| 30 |
|
---|
| 31 | /*
|
---|
| 32 | WaitHandle で保持されているすべてのリソースを解放します。
|
---|
| 33 | WaitHandleから継承
|
---|
| 34 | Virtual Sub Close()
|
---|
| 35 | End Sub
|
---|
| 36 | */
|
---|
| 37 |
|
---|
| 38 | /*CreateObjRef*/
|
---|
| 39 |
|
---|
| 40 | /*
|
---|
| 41 | WaitHandleから継承
|
---|
| 42 | Virtual Sub Dispose()
|
---|
| 43 | End Sub
|
---|
| 44 | */
|
---|
| 45 |
|
---|
| 46 | /*Equals*/
|
---|
| 47 | /*Finalize*/
|
---|
| 48 | /*GetAccessControl*/
|
---|
| 49 | /*GetHashCode*/
|
---|
| 50 | /*GetLifetimeService*/
|
---|
| 51 | /*InitializeLifetimeService*/
|
---|
| 52 | /*MemberwiseClone*/
|
---|
| 53 |
|
---|
| 54 |
|
---|
| 55 | /*
|
---|
| 56 | 既存の名前付き同期イベントを開きます。
|
---|
| 57 | */
|
---|
[599] | 58 | Static Function OpenExisting(name As String) As EventWaitHandle
|
---|
| 59 | If ActiveBasic.IsNothing(name) Then
|
---|
| 60 | Throw New ArgumentNullException("name")
|
---|
| 61 | Else If name.Length = 0 Then
|
---|
| 62 | Throw New ArgumentException("name")
|
---|
| 63 | End If
|
---|
| 64 | OpenExisting = New EventWaitHandle
|
---|
| 65 | Dim h = OpenEvent(EVENT_ALL_ACCESS, FALSE, ToTCStr(name))
|
---|
| 66 | If h = 0 Then
|
---|
| 67 | IO.Detail.ThrowWinLastErrorIOException("OpenEvent failed.")
|
---|
| 68 | End If
|
---|
| 69 | OpenExisting.Handle = h
|
---|
[417] | 70 | End Function
|
---|
| 71 |
|
---|
| 72 | /*
|
---|
| 73 | セキリティアクセスを指定して既存の名前付き同期イベントを開きます。
|
---|
| 74 | */
|
---|
| 75 | /* Static Function OpenExisting(name As String, rights As EventWaitHandleRights) As WaitHandle
|
---|
| 76 | TODO
|
---|
| 77 | End Function*/
|
---|
| 78 |
|
---|
| 79 | /*
|
---|
| 80 | イベントの状態を非シグナル状態に設定し、スレッドをブロックします。
|
---|
| 81 | */
|
---|
| 82 | Function Reset() As Boolean
|
---|
| 83 | If ResetEvent(This.Handle()) Then Return True
|
---|
| 84 | Reset=False
|
---|
| 85 | End Function
|
---|
| 86 |
|
---|
| 87 |
|
---|
| 88 | /*
|
---|
| 89 | イベントの状態をシグナル状態に設定し、待機している 1 つ以上のスレッドが進行できるようにします。
|
---|
| 90 | */
|
---|
| 91 | Function Set() As Boolean
|
---|
| 92 | If SetEvent(This.Handle()) Then Return True
|
---|
| 93 | Set=False
|
---|
| 94 | End Function
|
---|
| 95 |
|
---|
| 96 | /*SetAccessControl*/
|
---|
| 97 | /*ToString*/
|
---|
| 98 |
|
---|
| 99 | /*
|
---|
| 100 | WaitHandleから継承
|
---|
| 101 | WaitAll
|
---|
| 102 | WaitAny
|
---|
| 103 | WaitOne
|
---|
| 104 | */
|
---|
| 105 |
|
---|
| 106 | /*
|
---|
| 107 | WaitHandle から継承
|
---|
| 108 | Handle
|
---|
[599] | 109 | SafeWaitHandle
|
---|
[417] | 110 | */
|
---|
| 111 |
|
---|
| 112 | End Class
|
---|
| 113 |
|
---|
| 114 | End Namespace
|
---|
[419] | 115 | End Namespace
|
---|