in reply to Re^5: threads + sockets stalling question
in thread threads + sockets stalling question
the real problem is not that fstat and ftell lock the CRT
I agree with that, but rather than pointing the finger at accept(), (which (assumption!) locks the underlying file descriptor as it will be modified by when the call completes), but rather at the PerlIO that calls f*() calls on sockets.
I guess you could also blame the CRT for locking the file descriptors before checking whether they are valid handles for the operation to be performed.
Is it possible to recode accept to avoid the CRT?
On a cursory inspection I don't think so. accept() is just redined as win32_accept(), and that essentially just calls the CRT accept():
SOCKET win32_accept(SOCKET s, struct sockaddr *addr, int *addrlen) { SOCKET r; SOCKET_TEST((r = accept(TO_SOCKET(s), addr, addrlen)), INVALID_SOC +KET); return OPEN_SOCKET(r); }
I don't have access to the MSCRT sources, (I think you can pay for such access?), but from my point of view it's an opaque box. And probably should be.
In the end, like so many others, the root of this problem lies in the difficulty of trying to make a non-POSIX OS act like POSIX. It's amazing that as much works as does.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: threads + sockets stalling question
by Corion (Patriarch) on Mar 17, 2010 at 17:10 UTC | |
by BrowserUk (Patriarch) on Mar 17, 2010 at 17:32 UTC | |
by ikegami (Patriarch) on Mar 17, 2010 at 18:23 UTC | |
by BrowserUk (Patriarch) on Mar 18, 2010 at 23:51 UTC | |
by ikegami (Patriarch) on Mar 19, 2010 at 00:38 UTC | |
|