1 Nov 2010 04:35
Re: gensym, gentemp with threads
Sam Steingold <sds <at> gnu.org>
2010-11-01 03:35:42 GMT
2010-11-01 03:35:42 GMT
> * Vladimir Tzankov <igmnaxbi <at> tznvy.pbz> [2010-10-31 16:51:29 +0200]: > > On 10/31/10, Don Cohen <don-sourceforge-xxz <at> isis.cs3-inc.com> wrote: >> BTW, I'm guessing that gensym and gentemp are not protected in any way, >> so that two different threads could end up using the same names, >> and in the case of gentemp, returning the same symbols? > > gensym is not guarded in any way and it's possible to get same name in > different treads (by default every thread binds *gensym-counter* via > *default-special-bindings*). In presence of possible conflicts - may > be use unique thread prefix? > > gentemp is more problematic (have not looked on it till now). Again - > per thread prefix usage is fine but the internal counter is shared > among all threads. > > Another option is to use a form of atomic increment of counters (but > how exactly to do is problematic - cpu supported atomic increment does > not fit well clisp arithmetic, may be use mutex?). I think using a mutex in getsym & gentems (and not binding *gensym-counter* in every thread) is a good idea. these functions are usually called in macroexpansion, so they are not too speed-critical and not particularly prone to deadlocks. -- -- Sam Steingold (http://sds.podval.org/) on Ubuntu 10.04 (lucid) http://thereligionofpeace.com http://www.memritv.org http://pmw.org.il http://camera.org http://mideasttruth.com http://palestinefacts.org I'm out of my mind, but feel free to leave a message...(Continue reading)
RSS Feed