static VariantSF bottom_leader(th_context *th, VariantSF to_sgf)
{
	CPtr csf = subg_compl_stack_ptr(to_sgf) ;

	while(!is_leader(csf) )
		csf = prev_compl_frame(csf) ;
	return compl_subgoal_ptr(csf) ;
}
示例#2
0
文件: deadlock.c 项目: flavioc/XSB
static void ReclaimDSandMarkReset(th_context *th, VariantSF to, int leader)
{
	CPtr csf = openreg ;
	for(;;)
	{	if( !is_completed(compl_subgoal_ptr(csf)))
		/* Handle early completion */
		{	subg_grabbed(compl_subgoal_ptr(csf)) = TRUE ;
			subg_tid(compl_subgoal_ptr(csf)) = leader ;
    			subg_asf_list_ptr(compl_subgoal_ptr(csf)) = NULL;
    			subg_compl_susp_ptr(compl_subgoal_ptr(csf)) = NULL;
		}
        	if( compl_subgoal_ptr(csf) == to ) 
			break;
                csf = prev_compl_frame(csf) ;
        }
}
void reset_leader( th_context *th )
{
	VariantSF resetsgf ;
	reset_thread( th, th, compl_subgoal_ptr(openreg), &resetsgf );
}