Hello!

You could try extracting fd from a `stream->io_watcher.fd`. It is a bit
intrinsic, but should generally work.
Regarding closing them, I'd suggest to use `dup()` syscall for giving away
`fd` to another thread.

There is no general mechanism for it, but if you wish to stay inside
libuv's API - the only way will be a
transfer of handles via IPC pipe. I'm not sure if it has any performance
impact.

Cheers,
Fedor.


On Fri, Apr 18, 2014 at 1:55 AM, Scott <[email protected]> wrote:

> Quick libuv newbie question: suppose I want a web server running a few
> different simultaneous event loops in different threads, where a
> "front-end" loop reads all incoming HTTP requests, and then based on the
> contents of each request moves the actual handling of that request to a
> different event loop/thread.
>
> Is this possible in libuv?  I was hoping there'd be, say, (1) a function
> for removing a watcher from a given loop without closing its file
> descriptors, and (2) a way to get at the file descriptor or socket
> underlying a given uv_tcp_t, since given those two functions I could
> perhaps use uv_tcp_open to create a new watcher for the same socket in a
> different loop. So far I haven't found any such beasts in my perusal of the
> header files or documentation, though.
>
> (I realize it'd still be slightly tricky to pull off even with such
> functions since I'd probably have to have the thread running the first loop
> do the "remove watcher from first loop" part, but then have another thread
> running the second loop do the "add watcher to second loop" part, which
> means I'd presumably have to have some sort of threadsafe mechanism to pass
> the watcher or socket between the two threads.  I suspect this may be where
> someone tells me "Right. You don't want to do that.")
>
> Thanks,
> -- Scott
>
> --
> You received this message because you are subscribed to the Google Groups
> "libuv" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/libuv.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.

Reply via email to