当前位置: 首页>>代码示例>>C++>>正文


C++ crit_exit函数代码示例

本文整理汇总了C++中crit_exit函数的典型用法代码示例。如果您正苦于以下问题:C++ crit_exit函数的具体用法?C++ crit_exit怎么用?C++ crit_exit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了crit_exit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: kobj_class_uninstantiate

void
kobj_class_uninstantiate(kobj_class_t cls)
{
	lwkt_gettoken(&kobj_token);
	crit_enter();

	cls->refs--;
	if (cls->refs == 0)
		kobj_class_free(cls);

	crit_exit();
	lwkt_reltoken(&kobj_token);
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:13,代码来源:subr_kobj.c

示例2: reqlimit_conc_done

/** ***************************************************************************
 * Reduce the concurrent request count after this request has completed.
 * When max-connections is applied, check_request_limits() inserts this
 * function to be called during request cleanup.
 *
 * Params:
 *   data: ptr to data passed in to request_set_data() when the call was
 *         scheduled for this request. Used here to pass in a ptr to the
 *         bucket tracking this request.
 *
 */
void reqlimit_conc_done(void *data)
{
    bucket_info * bucket = (bucket_info *)data;
    assert(bucket != NULL);

    //----- START_CRIT ------------------------------

    crit_enter(reqlimit_crit);
    bucket->conc--;
    crit_exit(reqlimit_crit);

    //----- END_CRIT ------------------------------
}
开发者ID:OldsSourcesBackups,项目名称:Heliod-Web-Server,代码行数:24,代码来源:reqlimit.cpp

示例3: kobj_class_instantiate

void
kobj_class_instantiate(kobj_class_t cls)
{
	lwkt_gettoken(&kobj_token);
	crit_enter();

	if (!cls->ops)
		kobj_class_compile(cls);
	cls->refs++;

	crit_exit();
	lwkt_reltoken(&kobj_token);
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:13,代码来源:subr_kobj.c

示例4: iopoll_reset_state

static __inline void
iopoll_reset_state(struct iopoll_ctx *io_ctx)
{
	crit_enter();
	io_ctx->poll_burst = 5;
	io_ctx->pending_polls = 0;
	io_ctx->residual_burst = 0;
	io_ctx->phase = 0;
	io_ctx->kern_frac = 0;
	bzero(&io_ctx->poll_start_t, sizeof(io_ctx->poll_start_t));
	bzero(&io_ctx->prev_t, sizeof(io_ctx->prev_t));
	crit_exit();
}
开发者ID:varialus,项目名称:DragonFlyX,代码行数:13,代码来源:if_poll.c

示例5: lgue_start_ipifunc

/*
 * Start call
 */
static void
lgue_start_ipifunc(void *arg)
{
	struct ifnet *ifp;
	struct lwkt_msg *lmsg;

	ifp = arg;
	lmsg = &ifp->if_start_nmsg[mycpuid].lmsg;
	crit_enter();
	if (lmsg->ms_flags & MSGF_DONE)
		lwkt_sendmsg(ifnet_portfn(mycpuid), lmsg);
	crit_exit();
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:16,代码来源:if_lgue.c

示例6: ahci_xpt_poll

/*
 * Poll function.
 *
 * Generally this function gets called heavily when interrupts might be
 * non-operational, during a halt/reboot or panic.
 */
static
void
ahci_xpt_poll(struct cam_sim *sim)
{
	struct ahci_port *ap;

	ap = cam_sim_softc(sim);
	crit_enter();
	ahci_os_lock_port(ap);
	ahci_port_intr(ap, 1);
	ahci_os_unlock_port(ap);
	crit_exit();
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:19,代码来源:ahci_cam.c

示例7: poll_reset_state

static __inline void
poll_reset_state(struct pollctx *pctx)
{
	crit_enter();
	pctx->poll_burst = 5;
	pctx->reg_frac_count = 0;
	pctx->pending_polls = 0;
	pctx->residual_burst = 0;
	pctx->phase = 0;
	bzero(&pctx->poll_start_t, sizeof(pctx->poll_start_t));
	bzero(&pctx->prev_t, sizeof(pctx->prev_t));
	crit_exit();
}
开发者ID:varialus,项目名称:DragonFlyX,代码行数:13,代码来源:kern_poll.c

示例8: uhub_detach

/*
 * Called from process context when the hub is gone.
 * Detach all devices on active ports.
 */
static int
uhub_detach(device_t self)
{
	struct uhub_softc *sc = device_get_softc(self);
	struct usbd_hub *hub = sc->sc_hub->hub;
	struct usbd_port *rup;
	int port, nports;

	DPRINTF(("uhub_detach: sc=%port\n", sc));

	crit_enter();

	if (hub == NULL) {		/* Must be partially working */
		crit_exit();
		return (0);
	}

	usbd_abort_pipe(sc->sc_ipipe);
	usbd_close_pipe(sc->sc_ipipe);

	nports = hub->hubdesc.bNbrPorts;
	for(port = 0; port < nports; port++) {
		rup = &hub->ports[port];
		if (rup->device)
			usb_disconnect_port(rup, self);
	}

	usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_hub, self);

	if (hub->ports[0].tt)
		kfree(hub->ports[0].tt, M_USBDEV);
	kfree(hub, M_USBDEV);
	sc->sc_hub->hub = NULL;

	crit_exit();

	return (0);
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:42,代码来源:uhub.c

示例9: sc_mouse_move

/* move mouse */
void
sc_mouse_move(scr_stat *scp, int x, int y)
{
    crit_enter();
    scp->mouse_xpos = scp->mouse_oldxpos = x;
    scp->mouse_ypos = scp->mouse_oldypos = y;
    if (scp->font_size <= 0)
	scp->mouse_pos = scp->mouse_oldpos = 0;
    else
	scp->mouse_pos = scp->mouse_oldpos = 
	    (y/scp->font_size - scp->yoff)*scp->xsize + x/8 - scp->xoff;
    scp->status |= MOUSE_MOVED;
    crit_exit();
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:15,代码来源:scmouse.c

示例10: cothread_delete

/*
 * Wait for the target thread to terminate and then destroy the cothread
 * structure.
 */
void
cothread_delete(cothread_t *cotdp)
{
	cothread_t cotd;

	if ((cotd = *cotdp) != NULL) {
		unregister_int(cotd->intr_id, 0);
		crit_enter();
		pthread_join(cotd->pthr, NULL);
		crit_exit();
		kfree(cotd, M_DEVBUF);
		*cotdp = NULL;
	}
}
开发者ID:madhavsuresh,项目名称:DragonFlyBSD,代码行数:18,代码来源:cothread.c

示例11: adc_queue_start

static void
adc_queue_start(void)
{
        if (adc_busy)
                return;

        crit_enter();
        if (head) {
                adc_busy = true;
                adc_sample_prepare(head->mode);
                adc_sample_start(head->channel, adc_queue_sample_done, NULL);
        }
        crit_exit();
}
开发者ID:AM7000000,项目名称:mchck,代码行数:14,代码来源:adc_queue.c

示例12: sReadAiopID

/***************************************************************************
Function: sReadAiopID
Purpose:  Read the AIOP idenfication number directly from an AIOP.
Call:	  sReadAiopID(CtlP, aiop)
	  CONTROLLER_T *CtlP; Ptr to controller structure
	  int aiop: AIOP index
Return:   int: Flag AIOPID_XXXX if a valid AIOP is found, where X
		 is replace by an identifying number.
	  Flag AIOPID_NULL if no valid AIOP is found
Warnings: No context switches are allowed while executing this function.

*/
int sReadAiopID(CONTROLLER_T *CtlP, int aiop)
{
   Byte_t AiopID;		/* ID byte from AIOP */

   crit_enter();
   rp_writeaiop1(CtlP, aiop, _CMD_REG, RESET_ALL);     /* reset AIOP */
   rp_writeaiop1(CtlP, aiop, _CMD_REG, 0x0);
   AiopID = rp_readaiop1(CtlP, aiop, _CHN_STAT0) & 0x07;
   crit_exit();
   if(AiopID == 0x06)
      return(1);
   else 			       /* AIOP does not exist */
      return(-1);
}
开发者ID:juanfra684,项目名称:DragonFlyBSD,代码行数:26,代码来源:rp.c

示例13: rtc_alarm_cancel

void
rtc_alarm_cancel(struct rtc_alarm_ctx *ctx)
{
        crit_enter();
        struct rtc_alarm_ctx *tail = alarm_head;
        while (tail) {
                if (tail->next == ctx) {
                        tail->next = ctx->next;
                        break;
                }
                tail = tail->next;
        }
        crit_exit();
}
开发者ID:Zuph,项目名称:mchck,代码行数:14,代码来源:rtc.c

示例14: rfcomm_ctloutput

/*
 * rfcomm_ctloutput(request, socket, level, optname, opt)
 *
 */
void
rfcomm_ctloutput(netmsg_t msg)
{
	struct socket *so = msg->ctloutput.base.nm_so;
	struct sockopt *sopt = msg->ctloutput.nm_sopt;
	struct rfcomm_dlc *pcb = (struct rfcomm_dlc *) so->so_pcb;
	struct mbuf *m;
	int error = 0;

#ifdef notyet			/* XXX */
	DPRINTFN(2, "%s\n", prcorequests[sopt->sopt_dir]);
#endif

	if (pcb == NULL) {
		error = EINVAL;
		goto out;
	}

	if (sopt->sopt_level != BTPROTO_RFCOMM) {
		error = ENOPROTOOPT;
		goto out;
	}

	switch(sopt->sopt_dir) {
	case PRCO_GETOPT:
		m = m_get(M_WAITOK, MT_DATA);
		crit_enter();
		m->m_len = rfcomm_getopt(pcb, sopt->sopt_name, mtod(m, void *));
		crit_exit();		
		if (m->m_len == 0) {
			m_freem(m);
			m = NULL;
			error = ENOPROTOOPT;
		}
		soopt_from_kbuf(sopt, mtod(m, void *), m->m_len);
		break;

	case PRCO_SETOPT:
		error = rfcomm_setopt2(pcb, sopt->sopt_name, so, sopt);

		break;

	default:
		error = ENOPROTOOPT;
		break;
	}
out:
	lwkt_replymsg(&msg->ctloutput.base.lmsg, error);
}
开发者ID:Gwenio,项目名称:DragonFlyBSD,代码行数:53,代码来源:rfcomm_socket.c

示例15: atm_timeout

/*
 * Schedule a control block timeout
 * 
 * Place the supplied timer control block on the timer queue.  The
 * function (func) will be called in 't' timer ticks with the
 * control block address as its only argument.  There are ATM_HZ
 * timer ticks per second.  The ticks value stored in each block is
 * a delta of the number of ticks from the previous block in the queue.
 * Thus, for each tick interval, only the first block in the queue 
 * needs to have its tick value decremented.
 *
 * Arguments:
 *	tip	pointer to timer control block
 *	t	number of timer ticks until expiration
 *	func	pointer to function to call at expiration 
 *
 * Returns:
 *	none
 *
 */
void
atm_timeout(struct atm_time *tip, int t, void (*func)(struct atm_time *))
{
	struct atm_time	*tip1, *tip2;


	/*
	 * Check for double queueing error
	 */
	if (tip->ti_flag & TIF_QUEUED)
		panic("atm_timeout: double queueing");

	/*
	 * Make sure we delay at least a little bit
	 */
	if (t <= 0)
		t = 1;

	/*
	 * Find out where we belong on the queue
	 */
	crit_enter();
	for (tip1 = NULL, tip2 = atm_timeq; tip2 && (tip2->ti_ticks <= t); 
					    tip1 = tip2, tip2 = tip1->ti_next) {
		t -= tip2->ti_ticks;
	}

	/*
	 * Place ourselves on queue and update timer deltas
	 */
	if (tip1 == NULL)
		atm_timeq = tip;
	else
		tip1->ti_next = tip;
	tip->ti_next = tip2;

	if (tip2)
		tip2->ti_ticks -= t;
	
	/*
	 * Setup timer block
	 */
	tip->ti_flag |= TIF_QUEUED;
	tip->ti_ticks = t;
	tip->ti_func = func;

	crit_exit();
	return;
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:69,代码来源:atm_subr.c


注:本文中的crit_exit函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。