Module: Windows::Synchronize

Defined in:
lib/windows/synchronize.rb

Constant Summary collapse

INFINITE =
0xFFFFFFFF
WAIT_OBJECT_0 =
0
WAIT_TIMEOUT =
0x102
WAIT_ABANDONED =
128
WAIT_FAILED =
0xFFFFFFFF
QS_ALLEVENTS =

Wake mask constants

0x04BF
QS_ALLINPUT =
0x04FF
QS_ALLPOSTMESSAGE =
0x0100
QS_HOTKEY =
0x0080
QS_INPUT =
0x407
QS_KEY =
0x0001
QS_MOUSE =
0x0006
QS_MOUSEBUTTON =
0x0004
QS_MOUSEMOVE =
0x0002
QS_PAINT =
0x0020
QS_POSTMESSAGE =
0x0008
QS_RAWINPUT =
0x0400
QS_SENDMESSAGE =
0x0040
QS_TIMER =
0x0010
MWMO_ALERTABLE =

Wait type constants

0x0002
MWMO_INPUTAVAILABLE =
0x0004
MWMO_WAITALL =
0x0001
EVENT_ALL_ACCESS =

Access rights

0x1F0003
EVENT_MODIFY_STATE =
0x0002
MUTEX_ALL_ACCESS =
0x1F0001
MUTEX_MODIFY_STATE =
0x0001
SEMAPHORE_ALL_ACCESS =
0x1F0003
SEMAPHORE_MODIFY_STATE =
0x0002
CreateEvent =
Win32API.new('kernel32', 'CreateEvent', 'PIIP', 'L')
CreateMutex =
Win32API.new('kernel32', 'CreateMutex', 'PIP', 'L')
CreateSemaphore =
Win32API.new('kernel32', 'CreateSemaphore', 'PLLP', 'L')
GetOverlappedResult =
Win32API.new('kernel32', 'GetOverlappedResult', 'LPPI', 'I')
MsgWaitForMultipleObjects =
Win32API.new('user32', 'MsgWaitForMultipleObjects', 'LPILL', 'L')
MsgWaitForMultipleObjectsEx =
Win32API.new('user32', 'MsgWaitForMultipleObjectsEx', 'LPLLL', 'L')
OpenEvent =
Win32API.new('kernel32', 'OpenEvent', 'LIP', 'L')
OpenMutex =
Win32API.new('kernel32', 'OpenMutex', 'LIP', 'L')
OpenSemaphore =
Win32API.new('kernel32', 'OpenSemaphore', 'LIP', 'L')
ReleaseMutex =
Win32API.new('kernel32', 'ReleaseMutex', 'L', 'I')
ReleaseSemaphore =
Win32API.new('kernel32', 'ReleaseSemaphore', 'LLP', 'I')
ResetEvent =
Win32API.new('kernel32', 'ResetEvent', 'L', 'I')
SetEvent =
Win32API.new('kernel32', 'SetEvent', 'L', 'I')
WaitForMultipleObjects =
Win32API.new('kernel32', 'WaitForMultipleObjects', 'LPIL', 'L')
WaitForMultipleObjectsEx =
Win32API.new('kernel32', 'WaitForMultipleObjectsEx', 'LPILI', 'L')
WaitForSingleObject =
Win32API.new('kernel32', 'WaitForSingleObject', 'LL', 'L')
WaitForSingleObjectEx =
Win32API.new('kernel32', 'WaitForSingleObjectEx', 'LLI', 'L')

Instance Method Summary collapse

Instance Method Details

#CreateEvent(attributes, reset, state, name) ⇒ Object



62
63
64
# File 'lib/windows/synchronize.rb', line 62

def CreateEvent(attributes, reset, state, name)
   CreateEvent.call(attributes, reset, state, name)
end

#CreateMutex(attributes, owner, name) ⇒ Object



66
67
68
# File 'lib/windows/synchronize.rb', line 66

def CreateMutex(attributes, owner, name)
   CreateMutex.call(attributes, owner, name)
end

#CreateSemaphore(attributes, initial, max, name) ⇒ Object



70
71
72
# File 'lib/windows/synchronize.rb', line 70

def CreateSemaphore(attributes, initial, max, name)
   CreateSemaphore.call(attributes, initial, max, name)
end

#GetOverlappedResult(handle, overlapped, bytes_transferred, wait) ⇒ Object



74
75
76
# File 'lib/windows/synchronize.rb', line 74

def GetOverlappedResult(handle, overlapped, bytes_transferred, wait)
   GetOverlappedResult.call(handle, overlapped, bytes_transferred, wait)
end

#MsgWaitForMultipleObjects(count, handles, wait, milli, mask) ⇒ Object



78
79
80
# File 'lib/windows/synchronize.rb', line 78

def MsgWaitForMultipleObjects(count, handles, wait, milli, mask)
   MsgWaitForMultipleObjects.call(count, handles, wait, milli, mask)
end

#MsgWaitForMultipleObjectsEx(count, handles, milli, mask, flags) ⇒ Object



82
83
84
# File 'lib/windows/synchronize.rb', line 82

def MsgWaitForMultipleObjectsEx(count, handles, milli, mask, flags)
   MsgWaitForMultipleObjectsEx.call(count, handles, milli, mask, flags)
end

#OpenEvent(access, handle, name) ⇒ Object



94
95
96
# File 'lib/windows/synchronize.rb', line 94

def OpenEvent(access, handle, name)
   OpenEvent.call(access, handle, name)
end

#OpenMutex(access, handle, name) ⇒ Object



90
91
92
# File 'lib/windows/synchronize.rb', line 90

def OpenMutex(access, handle, name)
   OpenMutex.call(access, handle, name)
end

#OpenSemaphore(access, handle, name) ⇒ Object



86
87
88
# File 'lib/windows/synchronize.rb', line 86

def OpenSemaphore(access, handle, name)
   OpenSemaphore.call(access, handle, name)
end

#ReleaseMutex(handle) ⇒ Object



98
99
100
# File 'lib/windows/synchronize.rb', line 98

def ReleaseMutex(handle)
   ReleaseMutex.call(handle) != 0
end

#ReleaseSemaphore(handle, release_count, previous_count) ⇒ Object



102
103
104
# File 'lib/windows/synchronize.rb', line 102

def ReleaseSemaphore(handle, release_count, previous_count)
   ReleaseSemaphore.call(handle, release_count, previous_count) != 0
end

#ResetEvent(handle) ⇒ Object



106
107
108
# File 'lib/windows/synchronize.rb', line 106

def ResetEvent(handle)
   ResetEvent.call(handle) != 0
end

#SetEvent(handle) ⇒ Object



110
111
112
# File 'lib/windows/synchronize.rb', line 110

def SetEvent(handle)
   SetEvent.call(handle) != 0
end

#WaitForMultipleObjects(count, handles, wait_all, milliseconds) ⇒ Object



114
115
116
# File 'lib/windows/synchronize.rb', line 114

def WaitForMultipleObjects(count, handles, wait_all, milliseconds)
   WaitForMultipleObjects.call(count, handles, wait_all, milliseconds)
end

#WaitForMultipleObjectsEx(count, handles, wait_all, milliseconds, alertable) ⇒ Object



118
119
120
# File 'lib/windows/synchronize.rb', line 118

def WaitForMultipleObjectsEx(count, handles, wait_all, milliseconds, alertable)
   WaitForMultipleObjectsEx.call(count, handles, wait_all, milliseconds, alertable)
end

#WaitForSingleObject(handle, milliseconds) ⇒ Object



122
123
124
# File 'lib/windows/synchronize.rb', line 122

def WaitForSingleObject(handle, milliseconds)
   WaitForSingleObject.call(handle, milliseconds)
end

#WaitForSingleObjectEx(handle, milliseconds, alertable) ⇒ Object



126
127
128
# File 'lib/windows/synchronize.rb', line 126

def WaitForSingleObjectEx(handle, milliseconds, alertable)
   WaitForSingleObjectEx.call(handle, milliseconds, alertable)
end