' Classes/System/Threading/EventWaitHandle.ab

NameSpace System
NameSpace Threading

Enum EventResetMode
	AutoReset = False
	ManualReset = True
End Enum

Class EventWaitHandle
	Inherits System.Threading.WaitHandle

Public
	Sub EventWaitHandle (initialState As Boolean, mode As EventResetMode)
		This.Handle(CreateEvent(NULL,mode As BOOL,initialState As BOOL,NULL))
	End Sub
	Sub EventWaitHandle (initialState As Boolean, mode As EventResetMode, name As String)
		This.Handle(CreateEvent(NULL,mode As BOOL,initialState As BOOL,ToTCStr(name)))
	End Sub
	Sub EventWaitHandle (initialState As Boolean, mode As EventResetMode, name As String, ByRef createdNew As Boolean)
		This.Handle(CreateEvent(NULL,mode As BOOL,initialState As BOOL,ToTCStr(name)))
		If ERROR_ALREADY_EXISTS=GetLastError() Then createdNew=False Else createdNew=True
	End Sub
/*	Sub EventWaitHandle (initialState As Boolean, mode As EventResetMode, name As String, ByRef createdNew As Boolean, EventWaitHandleSecurity)
	TODO
	End Sub*/

/*
WaitHandle で保持されているすべてのリソースを解放します。
WaitHandleから継承
Virtual Sub Close()
End Sub
*/

/*CreateObjRef*/

/*
WaitHandleから継承
	Virtual Sub Dispose()
	End Sub
*/

/*Equals*/
/*Finalize*/
/*GetAccessControl*/
/*GetHashCode*/
/*GetLifetimeService*/
/*InitializeLifetimeService*/
/*MemberwiseClone*/


	/*
	既存の名前付き同期イベントを開きます。
	*/
	Static Function OpenExisting(name As String) As WaitHandle
		This.Handle(OpenEvent(EVENT_ALL_ACCESS,FALSE,ToTCStr(name)))
	End Function

	/*
	セキリティアクセスを指定して既存の名前付き同期イベントを開きます。
	*/
/*	Static Function OpenExisting(name As String, rights As EventWaitHandleRights) As WaitHandle
		TODO
	End Function*/

	/*
	イベントの状態を非シグナル状態に設定し、スレッドをブロックします。
	*/
	Function Reset() As Boolean
		If ResetEvent(This.Handle()) Then Return True
		Reset=False
	End Function


	/*
	イベントの状態をシグナル状態に設定し、待機している 1 つ以上のスレッドが進行できるようにします。
	*/
	Function Set() As Boolean
		If SetEvent(This.Handle()) Then Return True
		Set=False
	End Function

/*SetAccessControl*/
/*ToString*/

/*
WaitHandleから継承
WaitAll
WaitAny
WaitOne
*/

/*
WaitHandle から継承
Handle
SafeWaitHandle 
*/

End Class

End Namespace
End Namespace
