--0016e646a40015b7dd046e5226f0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hi Daniel,

On Thu, Jul 9, 2009 at 8:28 PM, Daniel Fort <naquad / gmail.com> wrote:

> > A Conditionariable, IO.select (which you already knew :),
> > or a blocking read on any socket or pipe.
> >
> Creating a new socketpair/pipe is pretty too much imho (no matter it's a
> very
> small object, but it exists and must be handled). I thought about some
> kind of
> semaphore, then process would look like:
>
> in thread:
>
> semaphore.wait_for_event
>
> in main:
>
> semaphore.emit_event
>
> >
> > Create a socketpair or pipe and and write to it from the main thread.
> > It's also useful with the self-pipe trick[1]
> >
> > If you're stuck on a platform without UNIX sockets or pipes, you can
> > also connect to your main TCPServer (or another private one) to
> > wakeup from select.
>
> that makes the same trouble as described above: one more file
> descriptor,
> which is overhead. I knew this solution and used it in C, but I thought
> ruby is able to provide some better solution.
> --
>

Look up EventMachine - it's what you want without re-inventing the wheel.

John

--0016e646a40015b7dd046e5226f0--