Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19404
Modified Files: Tag: devel_0_38 m_class.c Log Message: threadsafe hashtable as compile time option
Index: m_class.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_class.c,v retrieving revision 1.3.4.3 retrieving revision 1.3.4.4 diff -C2 -d -r1.3.4.3 -r1.3.4.4 *** m_class.c 21 Nov 2004 21:06:18 -0000 1.3.4.3 --- m_class.c 24 Nov 2004 16:29:02 -0000 1.3.4.4 *************** *** 508,512 **** --- 508,514 ---- { static t_symbol *symhash[HASHSIZE]; + #ifdef THREADSAFE_GENSYM static pthread_mutex_t hash_lock = PTHREAD_MUTEX_INITIALIZER; + #endif t_symbol **sym1, *sym2; *************** *** 528,532 **** }
! pthread_mutex_lock(&hash_lock); /* tb: maybe another thread added the symbol to the hash table --- 530,534 ---- }
! #ifdef THREADSAFE_GENSYM pthread_mutex_lock(&hash_lock); /* tb: maybe another thread added the symbol to the hash table *************** *** 541,544 **** --- 543,547 ---- sym1 = &sym2->s_next; } + #endif
if (oldsym) sym2 = oldsym; *************** *** 552,556 **** --- 555,561 ---- } *sym1 = sym2; + #ifdef THREADSAFE_GENSYM pthread_mutex_unlock(&hash_lock); + #endif return (sym2); }