Class: Isomorfeus::Speednode::AttachPipe
- Inherits:
-
Object
- Object
- Isomorfeus::Speednode::AttachPipe
- Includes:
- WindowsyThings
- Defined in:
- lib/isomorfeus/speednode/attach_pipe.rb
Defined Under Namespace
Classes: Overlapped
Constant Summary collapse
- CONNECTING_STATE =
0
- READING_STATE =
1
- WRITING_STATE =
2
- INSTANCES =
4
- PIPE_TIMEOUT =
5000
- BUFFER_SIZE =
65536
Constants included from WindowsyThings
WindowsyThings::ERROR_IO_PENDING, WindowsyThings::ERROR_PIPE_CONNECTED, WindowsyThings::ERROR_SUCCESS, WindowsyThings::FILE_FLAG_OVERLAPPED, WindowsyThings::INFINITE, WindowsyThings::INVALID_HANDLE_VALUE, WindowsyThings::PIPE_ACCESS_DUPLEX, WindowsyThings::PIPE_READMODE_BYTE, WindowsyThings::PIPE_READMODE_MESSAGE, WindowsyThings::PIPE_TYPE_BYTE, WindowsyThings::PIPE_TYPE_MESSAGE, WindowsyThings::PIPE_WAIT, WindowsyThings::QS_ALLINPUT
Instance Method Summary collapse
-
#initialize(pipe_name, block) ⇒ AttachPipe
constructor
A new instance of AttachPipe.
- #run ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(pipe_name, block) ⇒ AttachPipe
Returns a new instance of AttachPipe.
64 65 66 67 68 69 70 71 |
# File 'lib/isomorfeus/speednode/attach_pipe.rb', line 64 def initialize(pipe_name, block) @run_block = block @full_pipe_name = "\\\\.\\pipe\\#{pipe_name}" @instances = 1 @events = [] @events_pointer = FFI::MemoryPointer.new(:uintptr_t, @instances + 1) @pipe = {} end |
Instance Method Details
#run ⇒ Object
73 74 75 76 77 |
# File 'lib/isomorfeus/speednode/attach_pipe.rb', line 73 def run @running = true create_instance while_loop end |
#stop ⇒ Object
79 80 81 82 |
# File 'lib/isomorfeus/speednode/attach_pipe.rb', line 79 def stop @running = false STDERR.puts("DisconnectNamedPipe failed with #{GetLastError()}") if !DisconnectNamedPipe(@pipe[:instance]) end |