"Ralf S. Engelschall" wrote: > > It appears that the intent of setting a file descriptor to non-blocking > > mode via pth_fdmode() is to do for the thread what normal non-blocking > > (without pth involved) does for a process. > > > > Is this the intent? If so, that's great.. but then there are a few bugs > > in the implementation. > > Yes, that is the intent. > > > While pth_read() and pth_write() have been modified to properly handle > > the PTH_FDMODE_NONBLOCK case, this still needs to be done for other > > blocking syscalls, e.g. pth_connect() and pth_accept() to name two. > > They will block the thread even if the fdmode is PTH_FDMODE_NONBLOCK. > > Hmmm... yes, that's correct. My fault, I totally forgot these syscalls. > > > I'd really like to see this fixed, and would be willing to supply > > patches if that would help. > > Sure, it certainly helps. Feel free to post a patch.
Thanks... it's attached (but untested). Thanks, -Archie __________________________________________________________________________ Archie Cobbs * Packet Design * http://www.packetdesign.com
--- pth_high.c.orig Sat Mar 24 06:49:58 2001 +++ pth_high.c Thu Dec 6 09:53:30 2001 @@ -496,7 +496,7 @@ errno_shield { pth_fdmode(s, fdmode); } /* when it is still on progress wait until socket is really writeable */ - if (rv == -1 && errno == EINPROGRESS) { + if (rv == -1 && errno == EINPROGRESS && fdmode != PTH_FDMODE_NONBLOCK) { ev = pth_event(PTH_EVENT_FD|PTH_UNTIL_FD_WRITEABLE|PTH_MODE_STATIC, &ev_key, s); if (ev_extra != NULL) pth_event_concat(ev, ev_extra, NULL); @@ -541,7 +541,8 @@ /* poll socket via accept */ ev = NULL; while ((rv = pth_sc(accept)(s, addr, addrlen)) == -1 - && (errno == EAGAIN || errno == EWOULDBLOCK)) { + && (errno == EAGAIN || errno == EWOULDBLOCK) + && fdmode != PTH_FDMODE_NONBLOCK) { /* do lazy event allocation */ if (ev == NULL) { ev = pth_event(PTH_EVENT_FD|PTH_UNTIL_FD_READABLE|PTH_MODE_STATIC, &ev_key, s);