示例#1
0
void rstwdlist ()
{
	register struct tcb *tcbp;

	int cnt = 0;

	while (cnt < 20)
	{
		if (thewdlist[cnt])
		{
			tcbp = thewdlist[cnt];

	    	if (tcpval (tcbp) && watched (tcbp))
			{
				log (/* gettcbsocket (tcbp) */ -1, "tcp reset %s:%d",
					inet_ntoa (tcbp->conn.remote.address), tcbp->conn.remote.port);

			    reset_tcp (tcbp);
			}

//			thewdlist[cnt] = 0L;	/* make available for someone else */
			thewdlist[cnt] = (struct tcb*)0;
		}

		cnt++;
	}
}
示例#2
0
//====================================================================
bool CVariable::self_check(void)
{
    for (unsigned i=0; i< 2; ++i) {
        vector<CLitPoolElement *> & w = watched(i);
        for (unsigned j=0; j< w.size(); ++j) {
            assert ( w[j]->is_watched() );
            assert ( (unsigned) w[j]->var_sign() == i );
        }
    }
    return true;
}
示例#3
0
void CVariable::dump(ostream & os)
{
    if (is_marked()) os << "*" ;
    os << "V: " << _value << "  DL: " << _dlevel  << "  POS: "<< _assgn_stack_pos
       << "  Ante: " << _antecedent << endl;
    for (unsigned j=0; j< 2; ++j) {
        os << (j==0?"WPos ":"WNeg ") <<  "(" ;
        for (unsigned i=0; i< watched(j).size(); ++i )
            os << watched(j)[i]->find_clause_index() << "  " ;
        // os.seekp(os.tellp()-1);	// added by sang
        os << ")" << endl;
    }
#ifdef KEEP_LIT_CLAUSES
    for (unsigned j=0; j< 2; ++j) {
        os << (j==0?"Pos ":"Neg ") <<  "(" ;
        for (int i=0; i< lit_clause(j).size(); ++i )
            os << lit_clause(j)[i] << "  " ;
        os << ")" << endl;
    }
#endif
    os << endl;
}
示例#4
0
void dowatchtick (void)
{
    register struct tcb *tcbp;
 
	rstwdlist ();	/* process current list, reset anything if need be */ 

    /* now loop through all the current TCB entries */
    for (tcbp = Tcbs; tcbp != NULLTCB; tcbp = tcbp->next)
    {
		if (watched (tcbp))
			addwdlist (tcbp);
    }
  
    /* Restart timer */
    start_timer (&TcpWatchTimer) ;
}
示例#5
0
 void elim_eqs::cleanup_bin_watches(literal_vector const & roots) {
     vector<watch_list>::iterator it  = m_solver.m_watches.begin();
     vector<watch_list>::iterator end = m_solver.m_watches.end();
     for (unsigned l_idx = 0; it != end; ++it, ++l_idx) {
         watch_list & wlist = *it;
         literal l1 = ~to_literal(l_idx);
         literal r1 = norm(roots, l1);
         watch_list::iterator it2    = wlist.begin();
         watch_list::iterator itprev = it2;
         watch_list::iterator end2   = wlist.end();
         for (; it2 != end2; ++it2) {
             if (it2->is_binary_clause()) {
                 literal l2 = it2->get_literal();
                 literal r2 = norm(roots, l2);
                 if (r1 == r2) {
                     m_solver.assign(r1, justification());
                     if (m_solver.inconsistent())
                         return;
                     // consume unit
                     continue;
                 }
                 if (r1 == ~r2) {
                     // consume tautology
                     continue;
                 }
                 if (l1 != r1) {
                     // add half r1 => r2, the other half ~r2 => ~r1 is added when traversing l2
                     m_solver.m_watches[(~r1).index()].push_back(watched(r2, it2->is_learned()));
                     continue;
                 }
                 it2->set_literal(r2); // keep it
             }
             *itprev = *it2;
             itprev++;
         }
         wlist.set_end(itprev);
     }
 }