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


C++ callout_schedule函数代码示例

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

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

示例1: bthidev_ctl_disconnected

/*
 * Disconnected
 *
 * Depending on our state, this could mean several things, but essentially
 * we are lost. If both channels are closed, and we are marked to reconnect,
 * schedule another try otherwise just give up. They will contact us.
 */
static void
bthidev_ctl_disconnected(void *arg, int err)
{
	struct bthidev_softc *sc = arg;

	if (sc->sc_ctl != NULL) {
		l2cap_detach(&sc->sc_ctl);
		sc->sc_ctl = NULL;
	}

	sc->sc_state = BTHID_CLOSED;

	if (sc->sc_int == NULL) {
		aprint_normal_dev(sc->sc_dev, "disconnected\n");
		sc->sc_flags &= ~BTHID_CONNECTING;

		if (sc->sc_flags & BTHID_RECONNECT)
			callout_schedule(&sc->sc_reconnect,
					BTHID_RETRY_INTERVAL * hz);
		else
			sc->sc_state = BTHID_WAIT_CTL;
	} else {
		/*
		 * The interrupt channel should have been closed first,
		 * but its potentially unsafe to detach that from here.
		 * Give them a second to do the right thing or let the
		 * callout handle it.
		 */
		callout_schedule(&sc->sc_reconnect, hz);
	}
}
开发者ID:Tommmster,项目名称:netbsd-avr32,代码行数:38,代码来源:bthidev.c


示例2: bthidev_int_disconnected

static void
bthidev_int_disconnected(void *arg, int err)
{
	struct bthidev_softc *sc = arg;

	if (sc->sc_int != NULL) {
		l2cap_detach(&sc->sc_int);
		sc->sc_int = NULL;
	}

	sc->sc_state = BTHID_CLOSED;

	if (sc->sc_ctl == NULL) {
		aprint_normal_dev(sc->sc_dev, "disconnected\n");
		sc->sc_flags &= ~BTHID_CONNECTING;

		if (sc->sc_flags & BTHID_RECONNECT)
			callout_schedule(&sc->sc_reconnect,
					BTHID_RETRY_INTERVAL * hz);
		else
			sc->sc_state = BTHID_WAIT_CTL;
	} else {
		/*
		 * The control channel should be closing also, allow
		 * them a chance to do that before we force it.
		 */
		callout_schedule(&sc->sc_reconnect, hz);
	}
}
开发者ID:Tommmster,项目名称:netbsd-avr32,代码行数:29,代码来源:bthidev.c


示例3: gpiopwm_pulse

static void
gpiopwm_pulse(void *arg)
{
	struct gpiopwm_softc *sc;

	sc = arg;
	if (gpio_pin_read(sc->sc_gpio, &sc->sc_map, 0) == GPIO_PIN_HIGH) {
		gpio_pin_write(sc->sc_gpio, &sc->sc_map, 0, GPIO_PIN_LOW);
		callout_schedule(&sc->sc_pulse, sc->sc_ticks_off);
	} else {
		gpio_pin_write(sc->sc_gpio, &sc->sc_map, 0, GPIO_PIN_HIGH);
		callout_schedule(&sc->sc_pulse, sc->sc_ticks_on);
	}
}
开发者ID:eyberg,项目名称:rumpkernel-netbsd-src,代码行数:14,代码来源:gpiopwm.c


示例4: testcall

int
testcall(struct lwp *l, void *uap, register_t *retval)
{

	printf("test: initializing\n");

	mutex_init(&test_mutex, MUTEX_DEFAULT, IPL_NONE);
	cv_init(&test_cv, "testcv");
	test_sih = softint_establish(SOFTINT_MPSAFE | SOFTINT_SERIAL,
	    test_softint, NULL);
	callout_init(&test_ch, CALLOUT_MPSAFE);
	callout_setfunc(&test_ch, test_callout, NULL);

	printf("test: firing\n");
	callout_schedule(&test_ch, hz / 10);

	printf("test: waiting\n");
	mutex_enter(&test_mutex);
	while (!test_done) {
		cv_wait(&test_cv, &test_mutex);
	}
	mutex_exit(&test_mutex);

	printf("test: finished\n");

	callout_destroy(&test_ch);
	softint_disestablish(test_sih);
	mutex_destroy(&test_mutex);
	cv_destroy(&test_cv);

	return 0;
}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:32,代码来源:test_callout1.c


示例5: vcons_show_screen

static int
vcons_show_screen(void *v, void *cookie, int waitok,
    void (*cb)(void *, int, int), void *cb_arg)
{
	struct vcons_data *vd = v;
	struct vcons_screen *scr;

	scr = cookie;
	if (scr == vd->active)
		return 0;

	vd->wanted = scr;
	vd->switch_cb = cb;
	vd->switch_cb_arg = cb_arg;
#ifdef VCONS_SWITCH_ASYNC
	wakeup(&vd->start_drawing);
	return EAGAIN;
#else
	if (cb) {
		callout_schedule(&vd->switch_callout, 0);
		return EAGAIN;
	}

	vcons_do_switch(vd);
	return 0;
#endif
}
开发者ID:Tommmster,项目名称:netbsd-avr32,代码行数:27,代码来源:wsdisplay_vcons.c


示例6: vmt_sysctl_update_clock_sync_period

static int
vmt_sysctl_update_clock_sync_period(SYSCTLFN_ARGS)
{
	int error, period;
	struct sysctlnode node;
	struct vmt_softc *sc;

	node = *rnode;
	sc = (struct vmt_softc *)node.sysctl_data;

	period = sc->sc_clock_sync_period_seconds;
	node.sysctl_data = .
	error = sysctl_lookup(SYSCTLFN_CALL(&node));
	if (error || newp == NULL)
		return error;

	if (sc->sc_clock_sync_period_seconds != period) {
		callout_halt(&sc->sc_clock_sync_tick, NULL);
		sc->sc_clock_sync_period_seconds = period;
		if (sc->sc_clock_sync_period_seconds > 0)
			callout_schedule(&sc->sc_clock_sync_tick,
			    mstohz(sc->sc_clock_sync_period_seconds * 1000));
	}
	return 0;
}
开发者ID:goroutines,项目名称:rumprun,代码行数:25,代码来源:vmt.c


示例7: via_dmablit_timer

/*
 * A timer that regularly polls the blit engine in cases where we don't have interrupts:
 * a) Broken hardware (typically those that don't have any video capture facility).
 * b) Blit abort. The hardware doesn't send an interrupt when a blit is aborted.
 * The timer and hardware IRQ's can and do work in parallel. If the hardware has
 * irqs, it will shorten the latency somewhat.
 */
static void
via_dmablit_timer(void *arg)
{
	drm_via_blitq_t *blitq = (drm_via_blitq_t *)arg;
	struct drm_device *dev = blitq->dev;
	int engine = (int)
		(blitq - ((drm_via_private_t *)dev->dev_private)->blit_queues);

	DRM_DEBUG("Polling timer called for engine %d, jiffies %lu\n", engine,
		  (unsigned long) jiffies);

	via_dmablit_handler(dev, engine, 0);

	if (!callout_pending(&blitq->poll_timer)) {
		callout_schedule(&blitq->poll_timer, 1);

	       /*
		* Rerun handler to delete timer if engines are off, and
		* to shorten abort latency. This is a little nasty.
		*/

	       via_dmablit_handler(dev, engine, 0);

	}
}
开发者ID:JabirTech,项目名称:Source,代码行数:32,代码来源:via_dmablit.c


示例8: wb_sdmmc_intr

/*
 * intr handler 
 */
int
wb_sdmmc_intr(struct wb_softc *wb)
{
	uint8_t val;

	val = wb_read(wb, WB_SD_INTSTS);
	if (val == 0xff || val == 0x00)
		return 0;

	if (wb->wb_sdmmc_dev == NULL)
		return 1;

	wb->wb_sdmmc_intsts |= val;

	if (wb_sdmmc_debug) {
		char buf[64];
		snprintb(buf, sizeof(buf),
		    "\20\1TC\2BUSYEND\3PROGEND\4TIMEOUT"
		    "\5CRC\6FIFO\7CARD\010PENDING",
		    val);
		REPORT(wb, "WB_SD_INTSTS = %s\n", buf);
	}

	if (val & WB_INT_CARD)
		callout_schedule(&wb->wb_sdmmc_callout, hz / 4);

	return 1;
}
开发者ID:Tommmster,项目名称:netbsd-avr32,代码行数:31,代码来源:w83l518d_sdmmc.c


示例9: midi_rcv_asense

static void
midi_rcv_asense(void *arg)
{
	struct midi_softc *sc;

	sc = arg;

	mutex_enter(sc->lock);
	if (sc->dying || !sc->isopen) {
		mutex_exit(sc->lock);
		return;
	}
	if (sc->rcv_quiescent) {
		sc->rcv_eof = 1;
		sc->rcv_quiescent = 0;
		sc->rcv_expect_asense = 0;
		cv_broadcast(&sc->rchan);
		selnotify(&sc->rsel, 0, NOTE_SUBMIT);
		if (sc->async)
			softint_schedule(sc->sih);
		mutex_exit(sc->lock);
		return;
	}	
	sc->rcv_quiescent = 1;
	callout_schedule(&sc->rcv_asense_co, MIDI_RCV_ASENSE_PERIOD);
	mutex_exit(sc->lock);
}
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:27,代码来源:midi.c


示例10: midi_xmt_asense

static void
midi_xmt_asense(void *arg)
{
	struct midi_softc *sc;
	int error, armed;

	sc = arg;
	
	mutex_enter(sc->lock);
	if (sc->pbus || sc->dying || !sc->isopen) {
		mutex_exit(sc->lock);
		return;
	}
	sc->pbus = 1;
	if (sc->props & MIDI_PROP_OUT_INTR) {
		error = sc->hw_if->output(sc->hw_hdl, MIDI_ACK);
		armed = (error == 0);
	} else {
		error = sc->hw_if->output(sc->hw_hdl, MIDI_ACK);
		armed = 0;
	}
	if (!armed) {
		sc->pbus = 0;
		callout_schedule(&sc->xmt_asense_co, MIDI_XMT_ASENSE_PERIOD);
	}
	mutex_exit(sc->lock);
}
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:27,代码来源:midi.c


示例11: midi_intr_out

/*
 * The interrupt flavor acquires spl and lock once and releases at the end,
 * as it expects to write only one byte or message. The interface convention
 * is that if hw_if->output returns 0, it has initiated transmission and the
 * completion interrupt WILL be forthcoming; if it has not returned 0, NO
 * interrupt will be forthcoming, and if it returns EINPROGRESS it wants
 * another byte right away.
 */
static int
midi_intr_out(struct midi_softc *sc)
{
	struct midi_buffer *mb;
	int error, msglen;
	MIDI_BUF_DECLARE(idx);
	MIDI_BUF_DECLARE(buf);
	int armed = 0;

	KASSERT(mutex_owned(sc->lock));

	error = 0;
	mb = &sc->outbuf;

	MIDI_BUF_CONSUMER_INIT(mb,idx);
	MIDI_BUF_CONSUMER_INIT(mb,buf);
	
	while (idx_cur != idx_lim) {
		if (sc->hw_if_ext) {
			error = midi_msg_out(sc, &idx_cur, &idx_lim,
			    &buf_cur, &buf_lim);
			if (!error ) /* no EINPROGRESS from extended hw_if */
				armed = 1;
			break;
		}
		/* or, lacking hw_if_ext ... */
		msglen = MB_IDX_LEN(*idx_cur);
		error = sc->hw_if->output(sc->hw_hdl, *buf_cur);
		if (error &&  error != EINPROGRESS)
			break;
		++ buf_cur;
		MIDI_BUF_WRAP(buf);
		-- msglen;
		if (msglen)
			*idx_cur = PACK_MB_IDX(MB_IDX_CAT(*idx_cur),msglen);
		else {
			++ idx_cur;
			MIDI_BUF_WRAP(idx);
		}
		if (!error) {
			armed = 1;
			break;
		}
	}
	MIDI_BUF_CONSUMER_WBACK(mb,idx);
	MIDI_BUF_CONSUMER_WBACK(mb,buf);
	if (!armed) {
		sc->pbus = 0;
		callout_schedule(&sc->xmt_asense_co, MIDI_XMT_ASENSE_PERIOD);
	}
	cv_broadcast(&sc->wchan);
	selnotify(&sc->wsel, 0, NOTE_SUBMIT);
	if (sc->async) {
		softint_schedule(sc->sih);
	}
	if (error) {
		DPRINTF(("midi_intr_output error %d\n", error));
	}
	return error;
}
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:68,代码来源:midi.c


示例12: gpiopwm_set_off

static int
gpiopwm_set_off(SYSCTLFN_ARGS)
{
	struct sysctlnode node;
	struct gpiopwm_softc *sc;
	int val, error;

	node = *rnode;
	sc = node.sysctl_data;

	callout_halt(&sc->sc_pulse, NULL);
	gpio_pin_write(sc->sc_gpio, &sc->sc_map, 0, GPIO_PIN_LOW);
	node.sysctl_data = &val;

	val = sc->sc_ticks_off;
	error = sysctl_lookup(SYSCTLFN_CALL(&node));
	if (error || newp == NULL)
		return error;

	sc->sc_ticks_off = val;
	if (sc->sc_ticks_on > 0 && sc->sc_ticks_off > 0) {
		gpio_pin_write(sc->sc_gpio, &sc->sc_map, 0, GPIO_PIN_HIGH);
		callout_schedule(&sc->sc_pulse, sc->sc_ticks_on);
	}
	return 0;
}
开发者ID:eyberg,项目名称:rumpkernel-netbsd-src,代码行数:26,代码来源:gpiopwm.c


示例13: biconsdev_output

static void
biconsdev_output(struct tty *tp)
{
	int s, n;
	char buf[OBUFSIZ];

	s = spltty();
	if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP)) {
		splx(s);
		return;
	}
	tp->t_state |= TS_BUSY;
	splx(s);
	n = q_to_b(&tp->t_outq, buf, sizeof(buf));
	bicons_putn(buf, n);

	s = spltty();
	tp->t_state &= ~TS_BUSY;
	/* Come back if there's more to do */
	if (ttypull(tp)) {
		tp->t_state |= TS_TIMEOUT;
		callout_schedule(&tp->t_rstrt_ch, 1);
	}
	splx(s);
}
开发者ID:ryoon,项目名称:netbsd-xhci,代码行数:25,代码来源:biconsdev.c


示例14: mod_delayed_work

bool
mod_delayed_work(struct workqueue_struct *wq, struct delayed_work *dw,
    unsigned long ticks)
{
	bool timer_modified;

	KASSERT(wq != NULL);

	linux_work_lock(&dw->work);
	switch (dw->work.w_state) {
	case WORK_IDLE:
	case WORK_INVOKED:
		if (ticks == 0) {
			/* Skip the delay and queue it now.  */
			dw->work.w_state = WORK_PENDING;
			dw->work.w_wq = wq;
			workqueue_enqueue(wq->wq_workqueue, &dw->work.w_wk,
			    NULL);
		} else {
			callout_init(&dw->dw_callout, CALLOUT_MPSAFE);
			callout_reset(&dw->dw_callout, ticks,
			    &linux_worker_intr, dw);
			dw->work.w_state = WORK_DELAYED;
			dw->work.w_wq = wq;
			mutex_enter(&wq->wq_lock);
			TAILQ_INSERT_HEAD(&wq->wq_delayed, dw, dw_entry);
			mutex_exit(&wq->wq_lock);
		}
		timer_modified = false;
		break;

	case WORK_DELAYED:
		/*
		 * Timer is already ticking.  Reschedule it.
		 */
		callout_schedule(&dw->dw_callout, ticks);
		timer_modified = true;
		break;

	case WORK_PENDING:
		KASSERT(dw->work.w_wq == wq);
		timer_modified = false;
		break;

	case WORK_CANCELLED:
	case WORK_DELAYED_CANCELLED:
		/* XXX Wait for cancellation and then queue?  */
		timer_modified = false;
		break;

	default:
		panic("delayed work %p in bad state: %d", dw,
		    (int)dw->work.w_state);
		break;
	}
	linux_work_unlock(&dw->work);

	return timer_modified;
}
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:59,代码来源:linux_work.c


示例15: aps_refresh

static void
aps_refresh(void *arg)
{
	struct aps_softc *sc = arg;

	aps_refresh_sensor_data(sc);
	callout_schedule(&sc->sc_callout, (hz) / 2);
}
开发者ID:Tommmster,项目名称:netbsd-avr32,代码行数:8,代码来源:aps.c


示例16: zapm_cyclic

static void
zapm_cyclic(void *v)
{
	struct zapm_softc *sc = (struct zapm_softc *)v;

	zapm_poll1(sc, 1);

	callout_schedule(&sc->sc_cyclic_poll, CYCLIC_TIME);
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:9,代码来源:zapm.c


示例17: kprintf_init_callout

void
kprintf_init_callout(void)
{
	KASSERT(!kprintf_inited_callout);
	callout_init(&kprnd_callout, CALLOUT_MPSAFE);
	callout_setfunc(&kprnd_callout, kprintf_rnd_callout, NULL);
	callout_schedule(&kprnd_callout, hz);
	kprintf_inited_callout = true;
}
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:9,代码来源:subr_prf.c


示例18: wzero3kbd_tick

static void
wzero3kbd_tick(void *arg)
{
	struct wzero3kbd_softc *sc = (struct wzero3kbd_softc *)arg;

	(void) wzero3kbd_poll1(sc);

	callout_schedule(&sc->sc_keyscan_ch, sc->sc_interval);
}
开发者ID:krytarowski,项目名称:netbsd-current-src-sys,代码行数:9,代码来源:wzero3_kbd.c


示例19: acpitz_tick

static void
acpitz_tick(void *opaque)
{
    device_t dv = opaque;
    struct acpitz_softc *sc = device_private(dv);

    (void)AcpiOsExecute(OSL_NOTIFY_HANDLER, acpitz_get_status, dv);

    callout_schedule(&sc->sc_callout, sc->sc_zone.tzp * hz / 10);
}
开发者ID:rumpkernel-attic,项目名称:rumpkernel-netbsd-src,代码行数:10,代码来源:acpi_tz.c


示例20: vtrnd_timer

static void
vtrnd_timer(void *xsc)
{
	struct vtrnd_softc *sc;

	sc = xsc;

	vtrnd_harvest(sc);
	callout_schedule(&sc->vtrnd_callout, 5 * hz);
}
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:10,代码来源:virtio_random.c



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