From: Andrew P. <at...@pi...> - 2014-10-20 16:49:51
|
Although the C version of ns_cond is used in various places in Naviserver itself, clearly very few people actually use the Tcl ns_cond command. I have ns_cond working nicely for my needs and so don't plan to change anytime soon, but I do wonder: Is there a higher-level, more Tcl'ish way to accomplish the same thing (waking up another thread) as ns_cond these days? Perhaps something with the Tcl event loop? Or some other form of message passing? I expect that ns_cond will be more efficient, since it a thin layer over the POSIX C API, but it is tricky enough to use correctly that a more user-friendly alternative could be nice when doing general-purpose multi-threaded programming in Tcl. Of course, part of the beauty of Naviserver and AOLserver is that you rarely need to DO general-purpose multi-threaded programming, because they're already set up for the typical concurrency needs of a web server. But it is very nice that they (and the Tcl Threads Extension) have the tools available when you need to do something different. -- Andrew Piskorski <at...@pi...> |