From: <cli...@li...> - 2008-11-30 12:07:37
|
Send clisp-cvs mailing list submissions to cli...@li... To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/clisp-cvs or, via email, send a message with subject or body 'help' to cli...@li... You can reach the person managing the list at cli...@li... When replying, please edit your Subject line so it is more specific than "Re: Contents of clisp-cvs digest..." CLISP CVS commits for today Today's Topics: 1. clisp/src ChangeLog, 1.6667, 1.6668 spvw.d, 1.462, 1.463 spvw_global.d, 1.26, 1.27 zthread.d, 1.27, 1.28 (Vladimir Tzankov) 2. clisp/src ChangeLog,1.6668,1.6669 eval.d,1.263,1.264 (Vladimir Tzankov) ---------------------------------------------------------------------- Message: 1 Date: Sat, 29 Nov 2008 13:51:58 +0000 From: Vladimir Tzankov <vt...@us...> Subject: clisp/src ChangeLog, 1.6667, 1.6668 spvw.d, 1.462, 1.463 spvw_global.d, 1.26, 1.27 zthread.d, 1.27, 1.28 To: cli...@li... Message-ID: <E1L...@dd...> Update of /cvsroot/clisp/clisp/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv7491/src Modified Files: ChangeLog spvw.d spvw_global.d zthread.d Log Message: fix possible multithreading deadlocks Index: spvw.d =================================================================== RCS file: /cvsroot/clisp/clisp/src/spvw.d,v retrieving revision 1.462 retrieving revision 1.463 diff -u -d -r1.462 -r1.463 --- spvw.d 27 Nov 2008 09:16:25 -0000 1.462 +++ spvw.d 29 Nov 2008 13:51:56 -0000 1.463 @@ -346,6 +346,8 @@ storage must be added. = THREAD_SYMVALUES_ALLOCATION_SIZE/sizeof(gcv_object_t) */ global uintL maxnum_symvalues; +/* lock guarding the addition of new per thread special variables. */ +local xmutex_t thread_symvalues_lock; #ifdef DEBUG_GCSAFETY /* used during static initialization (before main() is called) @@ -629,6 +631,7 @@ /* TODO: put all global locks in some table. Soon we will have too many of them and the things will become unmanageble. */ xmutex_init(&allthreads_lock); /* threads lock */ + xmutex_init(&thread_symvalues_lock); /* for adding new thread symvalues */ xmutex_init(&open_files_lock); /* open files lock i.e. O(open_files) */ xmutex_init(&all_finalizers_lock); /* finalizer lock */ xmutex_init(&all_mutexes_lock); /* O(all_mutexes) lock */ @@ -657,11 +660,12 @@ /* currently there is just a single thread. get it.*/ var clisp_thread_t *thr=current_thread(); for_all_constsyms({ + /* some g++ version should use the commented. */ + /* gcv_object_t p=(gcv_object_t)symbol_tab_ptr_as_object(ptr); */ gcv_object_t p=symbol_tab_ptr_as_object(ptr); if (special_var_p(TheSymbol(p))) { /* Also we do not care about possibility to exceed the already allocated - space for _symvalues - we have enough space for the standard symbols. - */ + space for _symvalues - we have enough space for standard symbols.*/ thr->_ptr_symvalues[num_symvalues]=SYMVALUE_EMPTY; TheSymbol(p)->tls_index=num_symvalues++; } Index: zthread.d =================================================================== RCS file: /cvsroot/clisp/clisp/src/zthread.d,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- zthread.d 25 Nov 2008 18:48:51 -0000 1.27 +++ zthread.d 29 Nov 2008 13:51:56 -0000 1.28 @@ -1,3 +1,4 @@ + /* * CLISP thread functions - multiprocessing * Distributed under the GNU GPL as a part of GNU CLISP @@ -123,6 +124,8 @@ via reset(0) call. It discards the CATCH frame as well. Useful when an error (error xxx) happens in the thread. */ finish_entry_frame(DRIVER,returner,,{skipSTACK(2+3);goto end_of_thread;}); + /* initialize the low level i/o stuff for this thread*/ + init_reader_low(me); /* create special vars initial dynamic bindings. do not create DYNBIND frame since anyway we are at the "top level" of the thread. */ @@ -243,12 +246,6 @@ O(all_threads) = new_cons; unlock_threads(); /* allow GC and other thread creation. */ - /* initialize the reader, after we release the threads lock. - Otherwise deadlock may occur (if other thread triggers GC). - While holding the threads lock - we should never try to allocate anything - on the heap (unless we are sure we are the only running thread). */ - init_reader_low(new_thread); - /* create the OS thread */ if (xthread_create(&TheThread(lthr)->xth_system, &thread_stub,new_thread,cstack_size)) { Index: ChangeLog =================================================================== RCS file: /cvsroot/clisp/clisp/src/ChangeLog,v retrieving revision 1.6667 retrieving revision 1.6668 diff -u -d -r1.6667 -r1.6668 --- ChangeLog 29 Nov 2008 09:15:31 -0000 1.6667 +++ ChangeLog 29 Nov 2008 13:51:56 -0000 1.6668 @@ -1,5 +1,19 @@ 2008-11-29 Vladimir Tzankov <vtz...@gm...> + fix possible multithreading deadlocks + * spvw.d (thread_symvalues_lock): new mutex guarding the per thread + symvalues arrays in threads + (init_multithread): initialize it + * spvw_global.d (add_per_thread_special_var): use it. threads lock + used before may lead to deadlock in certain cases + * zthread.d (thread_stub): call init_reader_low() in the context of + the new thread + (MAKE-THREAD): remove init_reader_low() call (may cause deadlock if + it triggers GC - new thread is registered but not started - so it + cannot respond to the suspend request). + +2008-11-29 Vladimir Tzankov <vtz...@gm...> + * stream.d (WRITE-INTEGER): fix a GC-safety bug 2008-11-28 Vladimir Tzankov <vtz...@gm...> Index: spvw_global.d =================================================================== RCS file: /cvsroot/clisp/clisp/src/spvw_global.d,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- spvw_global.d 20 Nov 2008 23:05:04 -0000 1.26 +++ spvw_global.d 29 Nov 2008 13:51:56 -0000 1.27 @@ -661,9 +661,7 @@ { pushSTACK(symbol); /* lock threads (also this disables GC) */ - begin_blocking_call(); - lock_threads(); - end_blocking_call(); + GC_SAFE_MUTEX_LOCK(&thread_symvalues_lock); symbol=popSTACK(); var uintL symbol_index = TheSymbol(symbol)->tls_index; /* check whether till we have been waiting for the threads lock @@ -694,7 +692,7 @@ TheSymbol(symbol)->tls_index=symbol_index; for_all_threads({ thread->_ptr_symvalues[symbol_index] = SYMVALUE_EMPTY; }); leave: - unlock_threads(); + GC_SAFE_MUTEX_UNLOCK(&thread_symvalues_lock); if (symbol_index == SYMBOL_TLS_INDEX_NONE) error(error_condition,GETTEXT("could not make symbol value per-thread")); return symbol_index; ------------------------------ Message: 2 Date: Sat, 29 Nov 2008 14:04:59 +0000 From: Vladimir Tzankov <vt...@us...> Subject: clisp/src ChangeLog,1.6668,1.6669 eval.d,1.263,1.264 To: cli...@li... Message-ID: <E1L...@dd...> Update of /cvsroot/clisp/clisp/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8296/src Modified Files: ChangeLog eval.d Log Message: fix a GC-safety bug (cod_bind) Index: eval.d =================================================================== RCS file: /cvsroot/clisp/clisp/src/eval.d,v retrieving revision 1.263 retrieving revision 1.264 diff -u -d -r1.263 -r1.264 --- eval.d 23 Nov 2008 20:18:22 -0000 1.263 +++ eval.d 29 Nov 2008 14:04:57 -0000 1.264 @@ -6414,11 +6414,12 @@ U_operand(n); #if defined(MULTITHREAD) var Symbol sym=TheSymbol(TheCclosure(closure)->clos_consts[n]); - if (sym->tls_index == SYMBOL_TLS_INDEX_NONE && - !special_var_p(sym)) { + if (sym->tls_index == SYMBOL_TLS_INDEX_NONE && !special_var_p(sym)) { /* if it is special - it may be special global (i.e.*features*) so we do not want to make it per thread. */ + pushSTACK(value1); add_per_thread_special_var(TheCclosure(closure)->clos_consts[n]); + value1 = popSTACK(); closure = *closureptr; /* restore from stack in case of GC */ } #endif Index: ChangeLog =================================================================== RCS file: /cvsroot/clisp/clisp/src/ChangeLog,v retrieving revision 1.6668 retrieving revision 1.6669 diff -u -d -r1.6668 -r1.6669 --- ChangeLog 29 Nov 2008 13:51:56 -0000 1.6668 +++ ChangeLog 29 Nov 2008 14:04:57 -0000 1.6669 @@ -1,5 +1,9 @@ 2008-11-29 Vladimir Tzankov <vtz...@gm...> + * eval.d (interpret_bytecode_): fix a GC-safety bug (cod_bind) + +2008-11-29 Vladimir Tzankov <vtz...@gm...> + fix possible multithreading deadlocks * spvw.d (thread_symvalues_lock): new mutex guarding the per thread symvalues arrays in threads ------------------------------ ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ------------------------------ _______________________________________________ clisp-cvs mailing list cli...@li... https://lists.sourceforge.net/lists/listinfo/clisp-cvs End of clisp-cvs Digest, Vol 31, Issue 50 ***************************************** |