From: Rui M. <ru...@us...> - 2006-10-26 08:11:01
|
Update of /cvsroot/xsb/XSB/emu In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv13311 Modified Files: slginsts_xsb_i.h Log Message: changed lock to table try in shared completed tables to only lock the table it is shared Index: slginsts_xsb_i.h =================================================================== RCS file: /cvsroot/xsb/XSB/emu/slginsts_xsb_i.h,v retrieving revision 1.62 retrieving revision 1.63 diff -u -r1.62 -r1.63 --- slginsts_xsb_i.h 27 Sep 2006 22:03:43 -0000 1.62 +++ slginsts_xsb_i.h 26 Oct 2006 08:10:55 -0000 1.63 @@ -128,6 +128,7 @@ byte * inst_addr = lpcreg; int table_tid ; int grabbed = FALSE; + int table_is_shared; th_context * waiting_for_thread; #endif #ifdef MULTI_THREAD_RWL @@ -167,7 +168,9 @@ check_glstack_overflow(CallInfo_CallArity(callInfo),lpcreg,OVERFLOW_MARGIN); #ifdef SHARED_COMPL_TABLES - pthread_mutex_lock( &completing_mut ); + table_is_shared = get_shared(TIF_PSC(tip)); + if( table_is_shared ) + pthread_mutex_lock( &completing_mut ); #endif /* * Perform a call-check/insert operation on the current call. The @@ -214,7 +217,7 @@ If the subgoal frame is not new, and the table is being generated by a different thread, wait for it to complete. */ - if ( !IsNULL(producer_sf) ) { + if ( table_is_shared && !IsNULL(producer_sf) ) { while( !is_completed(producer_sf)) { /* if is leader and subgoal is marked to be computed by leader */ @@ -262,7 +265,8 @@ CallInfo_TableInfo(callInfo)); subg_tid(producer_sf) = th->tid; subg_grabbed(producer_sf) = 0; - pthread_mutex_unlock( &completing_mut ); + if (table_is_shared) + pthread_mutex_unlock( &completing_mut ); } else { subg_compl_stack_ptr(producer_sf) = openreg - COMPLFRAMESIZE; |