In alloc_2.d, when recycling a symbol binding index we cannot cons inside
authorJuan Jose Garcia Ripoll <jjgarcia@jjgr-2.local>
Sat, 23 Jan 2010 22:29:57 +0000 (23:29 +0100)
committerJuan Jose Garcia Ripoll <jjgarcia@jjgr-2.local>
Sat, 23 Jan 2010 22:29:57 +0000 (23:29 +0100)
a THREAD_OP_LOCK() region because this may be interrupted by a garbage
collection process - instead perform the allocation outside and then
do an atomic update of the indices list.

src/c/alloc_2.d

index b461b74..2f63c12 100644 (file)
@@ -495,10 +495,13 @@ standard_finalizer(cl_object o)
 #endif
 #ifdef ECL_THREADS
         case t_symbol: {
+                cl_object cons = ecl_list1(MAKE_FIXNUM(o->symbol.binding));
+                ecl_disable_interrupts();
                 THREAD_OP_LOCK();
-                cl_core.reused_indices = CONS(MAKE_FIXNUM(o->symbol.binding),
-                                              cl_core.reused_indices);
+                ECL_CONS_CDR(cons) = cl_core.reused_indices;
+                cl_core.reused_indices = cons;
                 THREAD_OP_UNLOCK();
+                ecl_enable_interrupts();
         }
 #endif
        default:;