pseudo-threaded / non preemptive server?

I am trying to put together a pseudo-threaded / non preemptive server
application. I compiled Library/Examples/listen.c, but even though the
listen socket has it's options set as non blocking, the event loop
select() call is blocking.

I have attached the trace of an unmodified version of listen. You clearly
see the socket being binded as non-blocking:

Socket...... Created 3
Net Manager. Increasing active sockets to 1, 0 persistent sockets
Socket...... Turned off Nagle's algorithm
Socket...... Non-blocking socket

And at first event loop iteration:

Event....... Registering socket for HTEvent_ACCEPT
Event....... New value for MaxSock is 3
Event Loop.. calling select: maxfds is 3
............. READ : 3
............. WRITE:
............. OOB  :

And it blocks..

So I started digging deeper into the HTEvtLst.c code, and found out that
there is a NULL timeout value being passed to the select() call. That's it!

Added HTHost_setEventTimeout(0); in listen.c, and now it's correctly
working as non-preemptive. Just wanted to share the joy (and in case push
this for an update in listen.c)

TTimo

Received on Thursday, 19 December 2002 13:27:16 UTC