Hi!

[snip]
> After doing some profiling, we noticed that the connections accepted on
> the duplicated socket on the secondary threads are using event handles
> instead of IOCP for async completion on windows, e.g.:
> 

Where does that duplicated socket come from? It's not 100% clear to me
what your architecture is, can you describe it a little? Do you have one
thread accepting connections and then send them over pipes to other
loops using uv_write2?

[snip]

> 
> I understand this use of libuv is off-label, and that the underlying
> implementation could change, but is there any concrete reason we
> shouldn't do this on Windows? Is there a better method of supporting
> multiple event loops on Windows without emulating IOCP?
> 

Depending on the Windows version you want to support (what I suggest
down here only works with Windows >= 8.1) you could try this:

- accept connections in a thread
- once the connection is accepted, use uv_fileno to grab the socket
handle and detach it from the loop's IOCP with [0], see
FileReplaceCompletionInformation.
- send the handle using uv_write2
- since the socket is not associated with any IOCP the duplicated one
shouldn't be either, thus allowing the receiving loop to use IOCP and
not the emulated mode
- profit?

After writing this I wonder if we shouldn't do this automagically in
libuv when sending a handle...

[0]:
https://msdn.microsoft.com/en-us/library/windows/hardware/ff567096%28v=vs.85%29.aspx


Hope that helps!


Regards,

-- 
Saúl Ibarra Corretgé
bettercallsaghul.com


-- 
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 https://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to