We don't bite newbies here... much | |
PerlMonks |
Re: Use thread with good care, but definitely keep using itby Revelation (Deacon) |
on Mar 14, 2003 at 00:02 UTC ( [id://242896]=note: print w/replies, xml ) | Need Help?? |
Please note that for backwards compatibility threading is not an option (especially with $VER <= perl 5.6). As pfaut also pointed out it's not always the best-option, anyways. The standards for threading aren't altogether clear, either, so I'd rather not use it as a production option for code that will be sent out. Therefore, I treat it much like an experimental function that's pretty far along in its development scale. (somewhere between lvalue and the builtins like open() I've come to trust) As you say "As demos, they are probably fine, but for real applications, this is extremely harmful, and makes absolutely no sense."
However, I prefer to use Net::Server with preforking when I need to create a server to do things. The module deals with a lot of the problems people will have (buffer overlflows, etc.) and is easily extensible. However, as the author asserts, it isn't as popular as the other server implementations (boohooo :O( ), and therefore needs users to write extensions and people to use it. I hope you, as well as other socket server people's try it; I've found it to be a great resource. (It might be interesting to write Net::Server::Threading, since threading is becomming more standardized as time goes on. Just make sure to use 5.8; in your code.) I say give threading more time (maybe the next major realease of perl 5 and they'll hopefully be more usable in perl 6). Meanwhile IO::Select and fork() seem to provide viable production alternatives. Gyan Kapur gkapur@myrealbox.com
In Section
Meditations
|
|