--- David Schwartz <[EMAIL PROTECTED]> wrote: > > > Is there a more efficient approach than this? And should I put a sleep > in > > that loop, or will the scheduler automatically handle everything? (I'll > > have about 150 threads in this loop simultaneously, each reading from > its > > own socket, with each socket delivering about 1 line of input per > > second.) > > > By the way, thanks for the excellent package -- I don't think I could > have > > 150 threads running without it! :-) > > > Damon > > Why not just have one thread that 'select's on all 150 sockets? > > DS
If the context-switching overhead turns out to be too high, then I will do exactly that. But it will mean maintaining state for each connection, and that state will only grow more complex with future enhancements by myself and others. The big draw to Pth for me is the simplicity of threaded code with the efficiency of a state machine. At least, I think it will be efficient. I don't actually know at this point exactly how expensive a context-switch in Pth is. __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com ______________________________________________________________________ GNU Portable Threads (Pth) http://www.gnu.org/software/pth/ Development Site http://www.ossp.org/pkg/lib/pth/ Distribution Files ftp://ftp.gnu.org/gnu/pth/ Distribution Snapshots ftp://ftp.ossp.org/pkg/lib/pth/ User Support Mailing List [EMAIL PROTECTED] Automated List Manager (Majordomo) [EMAIL PROTECTED]