예제 #1
0
void
timer_call_shutdown(
	processor_t			processor)
{
	timer_call_t		call;
	queue_t				queue, myqueue;

	assert(processor != current_processor());

	queue = &PROCESSOR_DATA(processor, timer_call_queue);
	myqueue = &PROCESSOR_DATA(current_processor(), timer_call_queue);

	simple_lock(&timer_call_lock);

	call = TC(queue_first(queue));

	while (!queue_end(queue, qe(call))) {
		_delayed_call_dequeue(call);

		_delayed_call_enqueue(myqueue, call);

		call = TC(queue_first(queue));
	}

	call = TC(queue_first(myqueue));

	if (!queue_end(myqueue, qe(call)))
		_set_delayed_call_timer(call);

	simple_unlock(&timer_call_lock);
}
예제 #2
0
static void test2(char const *ex) {
    smt_params params;
    params.m_model = true;
    ast_manager m;
    reg_decl_plugins(m);
    arith_util a(m);
    expr_ref fml = parse_fml(m, ex);
    app_ref_vector vars(m);
    expr_ref_vector lits(m);
    vars.push_back(m.mk_const(symbol("x"), a.mk_real()));
    vars.push_back(m.mk_const(symbol("y"), a.mk_real()));
    vars.push_back(m.mk_const(symbol("z"), a.mk_real()));
    flatten_and(fml, lits);

    smt::context ctx(m, params);
    ctx.push();
    ctx.assert_expr(fml);
    lbool result = ctx.check();
    VERIFY(result == l_true);
    ref<model> md;
    ctx.get_model(md);  
    ctx.pop(1);
    
    std::cout << mk_pp(fml, m) << "\n";

    expr_ref pr1(m), pr2(m), fml2(m);
    expr_ref_vector bound(m);
    ptr_vector<sort> sorts;
    svector<symbol> names;
    for (unsigned i = 0; i < vars.size(); ++i) {
        bound.push_back(vars[i].get());
        names.push_back(vars[i]->get_decl()->get_name());
        sorts.push_back(m.get_sort(vars[i].get()));
    }
    expr_abstract(m, 0, bound.size(), bound.c_ptr(), fml, fml2);
    fml2 = m.mk_exists(bound.size(), sorts.c_ptr(), names.c_ptr(), fml2);
    qe::expr_quant_elim qe(m, params);
    for (unsigned i = 0; i < vars.size(); ++i) {
        VERIFY(qe::arith_project(*md, vars[i].get(), lits));
    }
    pr1 = mk_and(lits);
    qe(m.mk_true(), fml2, pr2);
    std::cout << mk_pp(pr1, m) << "\n";
    std::cout << mk_pp(pr2, m) << "\n";

    expr_ref npr2(m);
    npr2 = m.mk_not(pr2);
    ctx.push();
    ctx.assert_expr(pr1);
    ctx.assert_expr(npr2);
    VERIFY(l_false == ctx.check());
    ctx.pop(1);       
}
예제 #3
0
파일: thread_call.c 프로젝트: CptFrazz/xnu
boolean_t
thread_call_enter1_delayed(
		thread_call_t			call,
		thread_call_param_t		param1,
		uint64_t			deadline)
{
	boolean_t		result = TRUE;
	thread_call_group_t	group;
	spl_t			s;

	group = thread_call_get_group(call);

	s = splsched();
	thread_call_lock_spin();

	result = _delayed_call_enqueue(call, group, deadline);

	if (queue_first(&group->delayed_queue) == qe(call))
		_set_delayed_call_timer(call, group);

	call->tc_call.param1 = param1;

	thread_call_unlock();
	splx(s);

	return (result);
}
예제 #4
0
mpqueue_head_t *
timer_call_dequeue_unlocked(
	timer_call_t 		call)
{
	call_entry_t	entry = CE(call);
	mpqueue_head_t	*old_queue;

	DBG("timer_call_dequeue_unlocked(%p)\n", call);

	simple_lock(&call->lock);
	old_queue = MPQUEUE(entry->queue);
	if (old_queue != NULL) {
		timer_call_lock_spin(old_queue);
		if (call->async_dequeue) {
			/* collision (1c): null queue pointer and reset flag */
			call->async_dequeue = FALSE;
#if TIMER_ASSERT
			timer_call_dequeue_unlocked_async1++;
#endif
		} else {
			(void)remque(qe(entry));
#if TIMER_ASSERT
			timer_call_dequeue_unlocked_async2++;
#endif
		}
		entry->queue = NULL;
		timer_call_unlock(old_queue);
	}
	simple_unlock(&call->lock);
	return (old_queue);
}
예제 #5
0
boolean_t
timer_call_cancel(
	timer_call_t			call)
{
	boolean_t		result = TRUE;
	spl_t			s;

	s = splclock();
	simple_lock(&timer_call_lock);

	if (call->state == DELAYED) {
		queue_t			queue = &PROCESSOR_DATA(current_processor(), timer_call_queue);

		if (queue_first(queue) == qe(call)) {
			_delayed_call_dequeue(call);

			if (!queue_empty(queue))
				_set_delayed_call_timer((timer_call_t)queue_first(queue));
		}
		else
			_delayed_call_dequeue(call);
	}
	else
		result = FALSE;

	simple_unlock(&timer_call_lock);
	splx(s);

	return (result);
}
예제 #6
0
boolean_t
timer_call_enter1(
	timer_call_t			call,
	timer_call_param_t		param1,
	uint64_t				deadline)
{
	boolean_t		result = TRUE;
	queue_t			queue;
	spl_t			s;

	s = splclock();
	simple_lock(&timer_call_lock);

	if (call->state == DELAYED)
		_delayed_call_dequeue(call);
	else
		result = FALSE;

	call->param1	= param1;
	call->deadline	= deadline;

	queue = &PROCESSOR_DATA(current_processor(), timer_call_queue);

	_delayed_call_enqueue(queue, call);

	if (queue_first(queue) == qe(call))
		_set_delayed_call_timer(call);

	simple_unlock(&timer_call_lock);
	splx(s);

	return (result);
}
예제 #7
0
파일: thread_call.c 프로젝트: CptFrazz/xnu
/*
 *	thread_call_func_delayed:
 *
 *	Enqueue a function callout to
 *	occur at the stated time.
 */
void
thread_call_func_delayed(
		thread_call_func_t		func,
		thread_call_param_t		param,
		uint64_t			deadline)
{
	thread_call_t		call;
	thread_call_group_t	group = &thread_call_groups[THREAD_CALL_PRIORITY_HIGH];
	spl_t			s;

	s = splsched();
	thread_call_lock_spin();

	call = _internal_call_allocate();
	call->tc_call.func	= func;
	call->tc_call.param0	= param;
	call->tc_call.param1	= 0;

	_delayed_call_enqueue(call, group, deadline);

	if (queue_first(&group->delayed_queue) == qe(call))
		_set_delayed_call_timer(call, group);

	thread_call_unlock();
	splx(s);
}
예제 #8
0
파일: thread_call.c 프로젝트: Prajna/xnu
/*
 *	_internal_call_release:
 *
 *	Release an internal callout entry which
 *	is no longer pending (or delayed).
 *
 * 	Called with thread_call_lock held.
 */
static __inline__ void
_internal_call_release(
    thread_call_t		call)
{
    if (    call >= internal_call_storage						&&
	   	    call < &internal_call_storage[internal_call_count]		)
		enqueue_head(&thread_call_internal_queue, qe(call));
}
예제 #9
0
    void execute(cmd_context & ctx) override {
        proof_ref pr(ctx.m());
        qe::simplify_rewriter_star qe(ctx.m());
        expr_ref result(ctx.m());

        qe(m_target, result, pr);            

        if (m_params.get_bool("print", true)) {
            ctx.display(ctx.regular_stream(), result);
            ctx.regular_stream() << std::endl; 
        }
        if (m_params.get_bool("print_statistics", false)) {
            statistics st;
            qe.collect_statistics(st);
            st.display(ctx.regular_stream());
        }
    }
예제 #10
0
파일: thread_call.c 프로젝트: CptFrazz/xnu
/*
 *	_internal_call_release:
 *
 *	Release an internal callout entry which
 *	is no longer pending (or delayed).
 *
 * 	Called with thread_call_lock held.
 */
static __inline__ void
_internal_call_release(
    thread_call_t		call)
{
    if (    call >= internal_call_storage						&&
	   	    call < &internal_call_storage[INTERNAL_CALL_COUNT]		)
		enqueue_head(&thread_call_internal_queue, qe(call));
}
예제 #11
0
static __inline__
void
_delayed_call_dequeue(
	timer_call_t			call)
{
	(void)remque(qe(call));

	call->state = IDLE;
}
예제 #12
0
void RT_IndicationProvider::_checkOperationContext(const OperationContext& context,
                                                  const String &  funcName)
{
	 //
	 // Test the filter query container
	 //
	 SubscriptionFilterQueryContainer qContainer = context.get(SubscriptionFilterQueryContainer::NAME);
    if (qContainer.getFilterQuery() == String::EMPTY)
    {
      PEGASUS_STD(cout) << funcName << "- empty filter query" << PEGASUS_STD(endl);
      throw CIMOperationFailedException(funcName + "- empty filter query");
    }
    if (qContainer.getQueryLanguage() == String::EMPTY)
    {
      PEGASUS_STD(cout) << funcName << "- empty filter query lang" << PEGASUS_STD(endl);
      throw CIMOperationFailedException(funcName + "- empty filter query lang");
    }

    CIMNamespaceName tst("root/SampleProvider");
    if (!qContainer.getSourceNameSpace().equal(tst))
    {
      PEGASUS_STD(cout) << funcName << "- incorrect source namespace" << PEGASUS_STD(endl);
      throw CIMOperationFailedException(funcName + "- incorrect source namespace");
    }

    try
    {
      //
      // Try to parse the filter query from the filter query container
      //
      CIMOMHandleQueryContext ctx(qContainer.getSourceNameSpace(), _cimom);
      QueryExpression qe(qContainer.getQueryLanguage(),
                         qContainer.getFilterQuery(),
                         ctx);

      // Exercise the QueryExpression...this will cause repository access through
      // the CIMOMHandleQueryContext.
      qe.validate();
    }
    catch (Exception & e)
    {
      PEGASUS_STD(cout) << funcName << "- parse error: " << e.getMessage() << PEGASUS_STD(endl);
      throw CIMOperationFailedException(funcName + "- parse error: " + e.getMessage());
    }

    //
    // Test the filter condition container.
    // Note:  since this only contains the WHERE clause, the condition could be empty (and will
    // be for some testcases)
    //
    SubscriptionFilterConditionContainer cContainer = context.get(SubscriptionFilterConditionContainer::NAME);
	 if (cContainer.getQueryLanguage() == String::EMPTY)
    {
      PEGASUS_STD(cout) << funcName << "- empty filter condition lang" << PEGASUS_STD(endl);
      throw CIMOperationFailedException(funcName + "- empty filter condition lang");
    }
}
예제 #13
0
파일: thread_call.c 프로젝트: Prajna/xnu
/*
 *	thread_call_initialize:
 *
 *	Initialize this module, called
 *	early during system initialization.
 */
void
thread_call_initialize(void)
{
	thread_call_t			call;
	thread_call_group_t		group = &thread_call_group0;
	kern_return_t			result;
	thread_t				thread;
	int						i;
	spl_t					s;

	i = sizeof (thread_call_data_t);
	thread_call_zone = zinit(i, 4096 * i, 16 * i, "thread_call");
	zone_change(thread_call_zone, Z_CALLERACCT, FALSE);
	zone_change(thread_call_zone, Z_NOENCRYPT, TRUE);

	lck_attr_setdefault(&thread_call_lck_attr);
	lck_grp_attr_setdefault(&thread_call_lck_grp_attr);
	lck_grp_init(&thread_call_queues_lck_grp, "thread_call_queues", &thread_call_lck_grp_attr);
	lck_grp_init(&thread_call_lck_grp, "thread_call", &thread_call_lck_grp_attr);

#if defined(__i386__) || defined(__x86_64__)
        lck_mtx_init(&thread_call_lock_data, &thread_call_lck_grp, &thread_call_lck_attr);
#else
        lck_spin_init(&thread_call_lock_data, &thread_call_lck_grp, &thread_call_lck_attr);
#endif
	queue_init(&group->pending_queue);
	queue_init(&group->delayed_queue);

	s = splsched();
	thread_call_lock_spin();

	timer_call_setup(&group->delayed_timer, thread_call_delayed_timer, group);

	wait_queue_init(&group->idle_wqueue, SYNC_POLICY_FIFO);
	wait_queue_init(&group->daemon_wqueue, SYNC_POLICY_FIFO);

	queue_init(&thread_call_internal_queue);
	for (
	    	call = internal_call_storage;
			call < &internal_call_storage[internal_call_count];
			call++) {

		enqueue_tail(&thread_call_internal_queue, qe(call));
	}

	thread_call_daemon_awake = TRUE;

	thread_call_unlock();
	splx(s);

	result = kernel_thread_start_priority((thread_continue_t)thread_call_daemon, group, BASEPRI_PREEMPT + 1, &thread);
	if (result != KERN_SUCCESS)
		panic("thread_call_initialize");

	thread_deallocate(thread);
}
예제 #14
0
파일: thread_call.c 프로젝트: CptFrazz/xnu
/*
 *	thread_call_initialize:
 *
 *	Initialize this module, called
 *	early during system initialization.
 */
void
thread_call_initialize(void)
{
	thread_call_t			call;
	kern_return_t			result;
	thread_t			thread;
	int				i;

	i = sizeof (thread_call_data_t);
	thread_call_zone = zinit(i, 4096 * i, 16 * i, "thread_call");
	zone_change(thread_call_zone, Z_CALLERACCT, FALSE);
	zone_change(thread_call_zone, Z_NOENCRYPT, TRUE);

	lck_attr_setdefault(&thread_call_lck_attr);
	lck_grp_attr_setdefault(&thread_call_lck_grp_attr);
	lck_grp_init(&thread_call_queues_lck_grp, "thread_call_queues", &thread_call_lck_grp_attr);
	lck_grp_init(&thread_call_lck_grp, "thread_call", &thread_call_lck_grp_attr);

#if defined(__i386__) || defined(__x86_64__)
        lck_mtx_init(&thread_call_lock_data, &thread_call_lck_grp, &thread_call_lck_attr);
#else
        lck_spin_init(&thread_call_lock_data, &thread_call_lck_grp, &thread_call_lck_attr);
#endif

	nanotime_to_absolutetime(0, THREAD_CALL_DEALLOC_INTERVAL_NS, &thread_call_dealloc_interval_abs);
	wait_queue_init(&daemon_wqueue, SYNC_POLICY_FIFO);

	thread_call_group_setup(&thread_call_groups[THREAD_CALL_PRIORITY_LOW], THREAD_CALL_PRIORITY_LOW, 0, TRUE);
	thread_call_group_setup(&thread_call_groups[THREAD_CALL_PRIORITY_USER], THREAD_CALL_PRIORITY_USER, 0, TRUE);
	thread_call_group_setup(&thread_call_groups[THREAD_CALL_PRIORITY_KERNEL], THREAD_CALL_PRIORITY_KERNEL, 1, TRUE);
	thread_call_group_setup(&thread_call_groups[THREAD_CALL_PRIORITY_HIGH], THREAD_CALL_PRIORITY_HIGH, THREAD_CALL_THREAD_MIN, FALSE);

	disable_ints_and_lock();

	queue_init(&thread_call_internal_queue);
	for (
			call = internal_call_storage;
			call < &internal_call_storage[INTERNAL_CALL_COUNT];
			call++) {

		enqueue_tail(&thread_call_internal_queue, qe(call));
	}

	thread_call_daemon_awake = TRUE;

	enable_ints_and_unlock();

	result = kernel_thread_start_priority((thread_continue_t)thread_call_daemon, NULL, BASEPRI_PREEMPT + 1, &thread);
	if (result != KERN_SUCCESS)
		panic("thread_call_initialize");

	thread_deallocate(thread);
}
예제 #15
0
/*
 * Remove timer entry from its queue but don't change the queue pointer
 * and set the async_dequeue flag. This is locking case 2b.
 */
static __inline__ void
timer_call_entry_dequeue_async(
	timer_call_t		entry)
{
	mpqueue_head_t	*old_queue = MPQUEUE(CE(entry)->queue);
	if (old_queue) {
		old_queue->count--;
		(void) remque(qe(entry));
		entry->async_dequeue = TRUE;
	}
	return;
}
예제 #16
0
파일: thread_call.c 프로젝트: Prajna/xnu
/*
 *	thread_call_func:
 *
 *	Enqueue a function callout.
 *
 *	Guarantees { function, argument }
 *	uniqueness if unique_call is TRUE.
 */
void
thread_call_func(
    thread_call_func_t		func,
    thread_call_param_t		param,
    boolean_t				unique_call)
{
    thread_call_t			call;
	thread_call_group_t		group = &thread_call_group0;
    spl_t					s;
    
    s = splsched();
    thread_call_lock_spin();
    
    call = TC(queue_first(&group->pending_queue));
    
	while (unique_call && !queue_end(&group->pending_queue, qe(call))) {
    	if (	call->func == func			&&
				call->param0 == param			) {
			break;
		}
	
		call = TC(queue_next(qe(call)));
    }
    
    if (!unique_call || queue_end(&group->pending_queue, qe(call))) {
		call = _internal_call_allocate();
		call->func			= func;
		call->param0		= param;
		call->param1		= NULL;
	
		_pending_call_enqueue(call, group);
		
		if (group->active_count == 0)
			thread_call_wake(group);
    }

    thread_call_unlock();
    splx(s);
}
예제 #17
0
int main()
{
  Eigen::VectorXd qs(2); //Start goal  coordinates (x,y)
  Eigen::VectorXd qe(2); //End goal  coordinates (x,y)
  Eigen::VectorXd xi; //Trajectory points (x0,y0,x1,y1,....)
  Eigen::MatrixXd obs; //obstacles |x0,y0,R0|
                      //           |x1,y1,R1|
                      //           | .......|
  qs<<0,0;
  qe<<3,5;

  chomp::generatePath(qs,qe,xi,obs);
  std::cout<<xi<<std::endl;
}
예제 #18
0
void QueryList::editQuery(QListWidgetItem* lbitem)
{
  if(lbitem)
  {
    // run the editor dialog
    QuerySource * qs = qsList->get(lbitem->text());

    if(qs == 0)
    {
      //qDebug("QueryList::editQuery(): Could not find '%s' in querylist\n",lbitem->text().latin1());
      return;
    }

    QueryEditor qe(this);
    qe.tbName->setText(qs->name());
    qe._metasql->setChecked(qs->loadFromDb());
    qe.tbQuery->setEnabled(!qs->loadFromDb());
    qe._mqlGroup->insertItem(0, qs->metaSqlGroup());
    qe._mqlGroup->setCurrentIndex(0);
    qe._mqlName->insertItem(0, qs->metaSqlName());
    qe._mqlName->setCurrentIndex(0);
    if(!qs->loadFromDb())
      qe.tbQuery->setText(qs->query());
    if(qe.exec() == QDialog::Accepted)
    {
      QString nname = qe.tbName->text();
      QString nquery = qe.tbQuery->toPlainText();
      bool mlfdb = qe._metasql->isChecked();
      QString mgroup = qe._mqlGroup->currentText();
      QString mname = qe._mqlName->currentText();
      if(qs->name() != nname)
      {
        // we changed the name of the query.
        // lets check to make sure we didn't change it to
        // something that already exists
        if(qsList->get(nname) != 0)
        {
          QMessageBox::warning(this, tr("Duplicate Name"), tr("The name you specified already exists in the list of query names."));
          return;
        }
        lbitem->setText(nname);
      }
      qs->setName(nname);
      qs->setQuery(nquery);
      qs->setLoadFromDb(mlfdb);
      qs->setMetaSqlGroup(mgroup);
      qs->setMetaSqlName(mname);
    }
  }
}
예제 #19
0
static __inline__
void
_delayed_call_enqueue(
	queue_t					queue,
	timer_call_t			call)
{
	timer_call_t	current;

	current = TC(queue_first(queue));

	while (TRUE) {
		if (	queue_end(queue, qe(current))			||
				call->deadline < current->deadline		) {
			current = TC(queue_prev(qe(current)));
			break;
		}

		current = TC(queue_next(qe(current)));
	}

	insque(qe(call), qe(current));

	call->state = DELAYED;
}
예제 #20
0
파일: thread_call.c 프로젝트: Prajna/xnu
void
thread_call_delayed_timer(
	timer_call_param_t				p0,
	__unused timer_call_param_t		p1
)
{
    thread_call_t			call;
	thread_call_group_t		group = p0;
	boolean_t				new_pending = FALSE;
	uint64_t				timestamp;

	thread_call_lock_spin();

	timestamp = mach_absolute_time();
    
    call = TC(queue_first(&group->delayed_queue));
    
    while (!queue_end(&group->delayed_queue, qe(call))) {
    	if (call->deadline <= timestamp) {
			_pending_call_enqueue(call, group);
			new_pending = TRUE;
		}
		else
			break;
	    
		call = TC(queue_first(&group->delayed_queue));
    }

	if (!queue_end(&group->delayed_queue, qe(call)))
		_set_delayed_call_timer(call, group);

    if (new_pending && group->active_count == 0)
		thread_call_wake(group);

    thread_call_unlock();
}
예제 #21
0
static void test_qe(ast_manager& m, lbool expected_outcome, expr* fml, char const* option) {

    //    enable_trace("bit2int");
    //enable_trace("gomory_cut");
    enable_trace("final_check_arith");
    enable_trace("arith_final_check");
    //enable_trace("arith_branching");
    enable_trace("theory_arith_int");
    enable_trace("presburger");
    enable_trace("quant_elim");
    // enable_trace("arith_simplifier_plugin");
    // enable_trace("non_linear");
    // enable_trace("gomory_cut_detail");
    // enable_trace("arith");
    // enable_trace("bv");
    // enable_trace("after_search");
    // enable_trace("bv_bit_prop");

    simplifier simp(m);
    front_end_params params;
    params.m_quant_elim = true;

    std::cout << mk_pp(fml, m) << "\n";
    qe::expr_quant_elim qe(m, params);
    expr_ref result(m);
    qe(m.mk_true(), fml, result);
    std::cout << " -> " << mk_pp(result, m) << " " << expected_outcome << "\n";
    if (expected_outcome == l_true && !m.is_true(result)) {
        std::cout << "ERROR: expected true, instead got " << ast_pp(result, m).c_str() << "\n";
        //exit(-1);
    }
    if (expected_outcome == l_false && !m.is_false(result)) {
        std::cout << "ERROR: expected false, instead got " << ast_pp(result, m).c_str() << "\n";
        //exit(-1);
    }
}
예제 #22
0
파일: api_qe.cpp 프로젝트: greatmazinger/z3
    Z3_ast Z3_API Z3_qe_lite (Z3_context c, Z3_ast_vector vars, Z3_ast body)
    {
        Z3_TRY;
        LOG_Z3_qe_lite (c, vars, body);
        RESET_ERROR_CODE();
        ast_ref_vector &vVars = to_ast_vector_ref (vars);

        app_ref_vector vApps (mk_c(c)->m());
        for (unsigned i = 0; i < vVars.size (); ++i) {
            app *a = to_app (vVars.get (i));
            if (a->get_kind () != AST_APP) {
                SET_ERROR_CODE (Z3_INVALID_ARG);
                RETURN_Z3(0);
            }
            vApps.push_back (a);
        }

        expr_ref result (mk_c(c)->m ());
        result = to_expr (body);

        params_ref p;
        qe_lite qe (mk_c(c)->m (), p);
        qe (vApps, result);

        // -- copy back variables that were not eliminated
        if (vApps.size () < vVars.size ()) {
            vVars.reset ();
            for (app* v : vApps) {
                vVars.push_back (v);
            }
        }

        mk_c(c)->save_ast_trail (result.get ());
        return of_expr (result);
        Z3_CATCH_RETURN(0);
    }
예제 #23
0
void
timer_queue_shutdown(
	mpqueue_head_t		*queue)
{
	timer_call_t		call;
	mpqueue_head_t		*new_queue;
	spl_t			s;

	DBG("timer_queue_shutdown(%p)\n", queue);

	s = splclock();

	/* Note comma operator in while expression re-locking each iteration */
	while (timer_call_lock_spin(queue), !queue_empty(&queue->head)) {
		call = TIMER_CALL(queue_first(&queue->head));
		if (!simple_lock_try(&call->lock)) {
			/*
			 * case (2b) lock order inversion, dequeue and skip
			 * Don't change the call_entry queue back-pointer
			 * but set the async_dequeue field.
			 */
			timer_queue_shutdown_lock_skips++;
			(void) remque(qe(call));
			call->async_dequeue = TRUE;
			timer_call_unlock(queue);
			continue;
		}

		/* remove entry from old queue */
		timer_call_entry_dequeue(call);
		timer_call_unlock(queue);

		/* and queue it on new */
		new_queue = timer_queue_assign(CE(call)->deadline);
		timer_call_lock_spin(new_queue);
		timer_call_entry_enqueue_deadline(
			call, new_queue, CE(call)->deadline);
		timer_call_unlock(new_queue);

		simple_unlock(&call->lock);
	}

	timer_call_unlock(queue);
	splx(s);
}
static void test_quant_solver(ast_manager& m, unsigned sz, app*const* xs, expr* fml, bool validate) {
    front_end_params params;
    qe::expr_quant_elim qe(m, params);
    qe::guarded_defs defs(m);
    bool success = qe.solve_for_vars(sz, xs, fml, defs);
    std::cout << "------------------------\n";
    std::cout << mk_pp(fml, m) << "\n";
    if (success) {        
        defs.display(std::cout);
        
        for (unsigned i = 0; validate && i < defs.size(); ++i) {     
            validate_quant_solution(m, fml, defs.guard(i), defs.defs(i));
        }
    }
    else {
        std::cout << "failed\n";
    }
}
 void mk_quantifier_instantiation::instantiate_quantifier(quantifier* q, expr_ref_vector & conjs) {
     expr_ref qe(m);
     qe = q;
     m_var2cnst(qe);        
     q = to_quantifier(qe);
     if (q->get_num_patterns() == 0) {
         proof_ref new_pr(m);
         pattern_inference_params params;
         pattern_inference infer(m, params);
         infer(q, qe, new_pr);
         q = to_quantifier(qe);
     }
     unsigned num_patterns = q->get_num_patterns();
     for (unsigned i = 0; i < num_patterns; ++i) {
         expr * pat = q->get_pattern(i);
         SASSERT(m.is_pattern(pat));
         instantiate_quantifier(q, to_app(pat), conjs);
     }
 }
void main()
{
    cout<<"Test class"<<endl;
    QueueWithPriority queue;
    QueueElement qe("element1", LOW);
    queue.putElement(qe);
    queue.putElement(QueueElement("element2", NORMAL));
    queue.putElement("element3", NORMAL);
    queue.putElement("element4", HIGH);
    queue.putElement("element5", HIGH);
    queue.putElement("element6", NORMAL);
    queue.putElement("element7", HIGH);
    queue.putElement("element8", LOW);

    queue.print_queue();
	cout<<endl<<"First element:"<<endl<<queue.getElement()<<endl;

	getch();
}
예제 #27
0
/*
 * Assumes call_entry and queues unlocked, interrupts disabled.
 */
__inline__ mpqueue_head_t *
timer_call_enqueue_deadline_unlocked(
	timer_call_t 			call,
	mpqueue_head_t			*queue,
	uint64_t			deadline)
{
	call_entry_t	entry = CE(call);
	mpqueue_head_t	*old_queue;

	DBG("timer_call_enqueue_deadline_unlocked(%p,%p,)\n", call, queue);

	simple_lock(&call->lock);
	old_queue = MPQUEUE(entry->queue);
	if (old_queue != NULL) {
		timer_call_lock_spin(old_queue);
		if (call->async_dequeue) {
			/* collision (1c): null queue pointer and reset flag */
			call->async_dequeue = FALSE;
			entry->queue = NULL;
#if TIMER_ASSERT
			timer_call_enqueue_deadline_unlocked_async1++;
#endif
		} else if (old_queue != queue) {
			(void)remque(qe(entry));
			entry->queue = NULL;
#if TIMER_ASSERT
			timer_call_enqueue_deadline_unlocked_async2++;
#endif
		}
		if (old_queue != queue) {
			timer_call_unlock(old_queue);
			timer_call_lock_spin(queue);
		}
	} else {
		timer_call_lock_spin(queue);
	}

	timer_call_entry_enqueue_deadline(call, queue, deadline);
	timer_call_unlock(queue);
	simple_unlock(&call->lock);

	return (old_queue);
}
예제 #28
0
MatchObject::MatchObject(QueryExpr* query,  bool has_reductions, uint32_t langid) :
    _query(NULL),
    _qt(),
    _nonterms(),
    _match_overlap(false),
    _max_arity(0),
    _has_reductions(has_reductions),
    _qt_byname(),
    _reduce_matchers()
{
    LOG(debug, "MatchObject(language %d)", langid);
    query_expander qe(*this, langid);
    query->Accept(qe); // Create a new, modified query
    _query = qe.NewQuery(); // Fetch the new query..

    if (LOG_WOULD_LOG(debug)) {
        std::string s;
        _query->Dump(s);
        LOG(debug, "juniper::MatchObject(language id %d): modified stack: %s",
            langid, s.c_str());
    }
    _max_arity = _query->MaxArity();
}
예제 #29
0
void QueryList::btnAdd_clicked()
{
  // add a new querySource item
  QueryEditor qe(this);
  if(qe.exec() == QDialog::Accepted)
  {
    QString nname = qe.tbName->text();
    QString nquery = qe.tbQuery->toPlainText();
    bool nmql = qe._metasql->isChecked();
    QString mgroup = qe._mqlGroup->currentText();
    QString mname  = qe._mqlName->currentText();
    QuerySource * qs = new QuerySource(nname, nquery, nmql, mgroup, mname);
    if(qsList->add(qs) == TRUE)
    {
      lbQuerys->addItem(nname);
    }
    else
    {
      // The item was not inserted for some reason
      qDebug("Failed to insert into into QuerySourceList");
      delete qs;
    }
  }
}
예제 #30
0
파일: thread_call.c 프로젝트: Prajna/xnu
/*
 *	thread_call_enter_delayed:
 *
 *	Enqueue a callout entry to occur
 *	at the stated time.
 *
 *	Returns TRUE if the call was
 *	already on a queue.
 */
boolean_t
thread_call_enter_delayed(
    thread_call_t		call,
    uint64_t			deadline)
{
	boolean_t				result = TRUE;
	thread_call_group_t		group = &thread_call_group0;
	spl_t					s;

	s = splsched();
	thread_call_lock_spin();

	result = _delayed_call_enqueue(call, group, deadline);

	if (queue_first(&group->delayed_queue) == qe(call))
		_set_delayed_call_timer(call, group);

	call->param1 = 0;

	thread_call_unlock();
	splx(s);

	return (result);
}