From: "Avdi B. Grimm" Date: 2001-09-24T12:18:30+09:00 Subject: [ruby-talk:21616] opening a named pipe? I'm having trouble reading from a named pipe in linux. basicly, I'm creating a pipe for another program (diald) to write status information to, opening the pipe, and then telling the external program to start writing to the named pipe. A simplified version of the code follows: `mkfifo #{$STATUS_FIFO_NAME}` File.open($STATUS_FIFO_NAME, 'r') {|status_fifo| sendCmdToDiald 'monitor', $STATUS_FIFO_NAME timeout(2.0) { # ensure this doesn't read indefinitely # ... read and store data from the pipe } } Except on rare occasions, this code never gets past the call to File#open. It just hangs on the open indefinitely. I can't even put a timeout on the 'open' call; presumably because it's an IO issue and Ruby threads all halt for IO. Every now and then, with no predictability, the code works perfectly, but it usually hangs. 1. Can anyone tell me what I'm doing wrong? 2. Has anyone created a Ruby wrapper for mkfifo or any of the other more obscure *NIX calls? 'ftools' seems to only contain cross-platform file commands. 3. Is anyone working on native threads for Ruby yet? Having threads that may block unpredictably is incredibly annoying for someone used to coding fully-multithreaded apps in C++. Couldn't we just wrap the excellent ACE middleware? No need to reinvent the wheel...