• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ cv_wait_sig函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: bcm2835_audio_detach

static int
bcm2835_audio_detach(device_t dev)
{
	int r;
	struct bcm2835_audio_info *sc;
	sc = pcm_getdevinfo(dev);

	/* Stop worker thread */
	BCM2835_AUDIO_LOCK(sc);
	sc->worker_state = WORKER_STOPPING;
	cv_signal(&sc->worker_cv);
	/* Wait for thread to exit */
	while (sc->worker_state != WORKER_STOPPED)
		cv_wait_sig(&sc->worker_cv, &sc->lock);
	BCM2835_AUDIO_UNLOCK(sc);

	r = pcm_unregister(dev);
	if (r)
		return r;

	mtx_destroy(&sc->lock);
	cv_destroy(&sc->worker_cv);

	bcm2835_audio_release(sc);

    	free(sc, M_DEVBUF);

	return 0;
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:29,代码来源:bcm2835_audio.c


示例2: bcm2835_audio_update_controls

static void
bcm2835_audio_update_controls(struct bcm2835_audio_info *sc)
{
	VC_AUDIO_MSG_T m;
	int ret, db;

	VCHIQ_VCHI_LOCK(sc);
	if (sc->vchi_handle != VCHIQ_SERVICE_HANDLE_INVALID) {
		vchi_service_use(sc->vchi_handle);

		sc->msg_result = -1;

		m.type = VC_AUDIO_MSG_TYPE_CONTROL;
		m.u.control.dest = sc->dest;
		if (sc->volume > 99)
			sc->volume = 99;
		db = db_levels[sc->volume/5];
		m.u.control.volume = VCHIQ_AUDIO_VOLUME(db);

		ret = vchi_msg_queue(sc->vchi_handle,
		    &m, sizeof m, VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL);

		if (ret != 0)
			printf("%s: vchi_msg_queue failed (err %d)\n", __func__, ret);

		mtx_lock(&sc->msg_avail_lock);
		cv_wait_sig(&sc->msg_avail_cv, &sc->msg_avail_lock);
		if (sc->msg_result)
			printf("%s failed: %d\n", __func__, sc->msg_result);
		mtx_unlock(&sc->msg_avail_lock);

		vchi_service_release(sc->vchi_handle);
	}
	VCHIQ_VCHI_UNLOCK(sc);
}
开发者ID:fengsi,项目名称:freebsd,代码行数:35,代码来源:bcm2835_audio.c


示例3: bcm2835_audio_worker

static void
bcm2835_audio_worker(void *data)
{
	struct bcm2835_audio_info *sc = (struct bcm2835_audio_info *)data;
	struct bcm2835_audio_chinfo *ch = &sc->pch;
	mtx_lock(&sc->data_lock);
	while(1) {

		if (sc->unloading)
			break;

		if ((ch->playback_state == PLAYBACK_PLAYING) &&
		    (vchiq_unbuffered_bytes(ch) >= VCHIQ_AUDIO_PACKET_SIZE)
		    && (ch->free_buffer >= VCHIQ_AUDIO_PACKET_SIZE)) {
			bcm2835_audio_write_samples(ch);
		} else {
			if (ch->playback_state == PLAYBACK_STOPPING) {
				bcm2835_audio_reset_channel(&sc->pch);
				ch->playback_state = PLAYBACK_IDLE;
			}

			cv_wait_sig(&sc->data_cv, &sc->data_lock);

			if (ch->playback_state == PLAYBACK_STARTING) {
				/* Give it initial kick */
				chn_intr(sc->pch.channel);
				ch->playback_state = PLAYBACK_PLAYING;
			}
		}
	}
	mtx_unlock(&sc->data_lock);

	kproc_exit(0);
}
开发者ID:fengsi,项目名称:freebsd,代码行数:34,代码来源:bcm2835_audio.c


示例4: logread

/*ARGSUSED*/
static	int
logread(struct cdev *dev, struct uio *uio, int flag)
{
	char buf[128];
	struct msgbuf *mbp = msgbufp;
	int error = 0, l;

	mtx_lock(&msgbuf_lock);
	while (msgbuf_getcount(mbp) == 0) {
		if (flag & IO_NDELAY) {
			mtx_unlock(&msgbuf_lock);
			return (EWOULDBLOCK);
		}
		if ((error = cv_wait_sig(&log_wakeup, &msgbuf_lock)) != 0) {
			mtx_unlock(&msgbuf_lock);
			return (error);
		}
	}

	while (uio->uio_resid > 0) {
		l = imin(sizeof(buf), uio->uio_resid);
		l = msgbuf_getbytes(mbp, buf, l);
		if (l == 0)
			break;
		mtx_unlock(&msgbuf_lock);
		error = uiomove(buf, l, uio);
		if (error || uio->uio_resid == 0)
			return (error);
		mtx_lock(&msgbuf_lock);
	}
	mtx_unlock(&msgbuf_lock);
	return (error);
}
开发者ID:dcui,项目名称:FreeBSD-9.3_kernel,代码行数:34,代码来源:subr_log.c


示例5: cnread

/* ARGSUSED */
static int
cnread(dev_t dev, struct uio *uio, struct cred *cred)
{
	kcondvar_t	sleep_forever;
	kmutex_t	sleep_forever_mutex;

	if (rconsvp == NULL) {
		/*
		 * Go to sleep forever.  This seems like the least
		 * harmful thing to do if there's no console.
		 * EOF might be better if we're ending up single-user
		 * mode.
		 */
		cv_init(&sleep_forever, NULL, CV_DRIVER, NULL);
		mutex_init(&sleep_forever_mutex, NULL, MUTEX_DRIVER, NULL);
		mutex_enter(&sleep_forever_mutex);
		(void) cv_wait_sig(&sleep_forever, &sleep_forever_mutex);
		mutex_exit(&sleep_forever_mutex);
		return (EIO);
	}

	if (rconsvp->v_stream != NULL)
		return (strread(rconsvp, uio, cred));
	else
		return (cdev_read(rconsdev, uio, cred));
}
开发者ID:apprisi,项目名称:illumos-gate,代码行数:27,代码来源:cons.c


示例6: down_interruptible

int
down_interruptible(struct semaphore *s)
{
	int ret ;

	ret = 0;

	mtx_lock(&s->mtx);

	while (s->value == 0) {
		s->waiters++;
		ret = cv_wait_sig(&s->cv, &s->mtx);
		s->waiters--;

		if (ret == EINTR) {
			mtx_unlock(&s->mtx);
			return (-EINTR);
		}

		if (ret == ERESTART)
			continue;
	}

	s->value--;
	mtx_unlock(&s->mtx);

	return (0);
}
开发者ID:brd,项目名称:vchiq-freebsd,代码行数:28,代码来源:vchi_bsd.c


示例7: bcm2835_audio_update_params

static void
bcm2835_audio_update_params(struct bcm2835_audio_info *sc, struct bcm2835_audio_chinfo *ch)
{
	VC_AUDIO_MSG_T m;
	int ret;

	VCHIQ_VCHI_LOCK(sc);
	if (sc->vchi_handle != VCHIQ_SERVICE_HANDLE_INVALID) {
		vchi_service_use(sc->vchi_handle);

		sc->msg_result = -1;

		m.type = VC_AUDIO_MSG_TYPE_CONFIG;
		m.u.config.channels = AFMT_CHANNEL(ch->fmt);
		m.u.config.samplerate = ch->spd;
		m.u.config.bps = AFMT_BIT(ch->fmt);

		ret = vchi_msg_queue(sc->vchi_handle,
		    &m, sizeof m, VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL);

		if (ret != 0)
			printf("%s: vchi_msg_queue failed (err %d)\n", __func__, ret);

		mtx_lock(&sc->msg_avail_lock);
		cv_wait_sig(&sc->msg_avail_cv, &sc->msg_avail_lock);
		if (sc->msg_result)
			printf("%s failed: %d\n", __func__, sc->msg_result);
		mtx_unlock(&sc->msg_avail_lock);

		vchi_service_release(sc->vchi_handle);
	}
	VCHIQ_VCHI_UNLOCK(sc);
}
开发者ID:fengsi,项目名称:freebsd,代码行数:33,代码来源:bcm2835_audio.c


示例8: port_alloc_event_block

/*
 * port_alloc_event_block() has the same functionality of port_alloc_event() +
 * - it blocks if not enough event slots are available and
 * - it blocks if not enough memory is available.
 * Currently port_dispatch() is using this function to increase the
 * reliability of event delivery for library event sources.
 */
int
port_alloc_event_block(port_t *pp, int source, int flags,
    port_kevent_t **pkevpp)
{
	port_kevent_t *pkevp =
	    kmem_cache_alloc(port_control.pc_cache, KM_SLEEP);

	mutex_enter(&pp->port_queue.portq_mutex);
	while (pp->port_curr >= pp->port_max_events) {
		if (!cv_wait_sig(&pp->port_cv, &pp->port_queue.portq_mutex)) {
			/* signal detected */
			mutex_exit(&pp->port_queue.portq_mutex);
			kmem_cache_free(port_control.pc_cache, pkevp);
			return (EINTR);
		}
	}
	pp->port_curr++;
	mutex_exit(&pp->port_queue.portq_mutex);

	bzero(pkevp, sizeof (port_kevent_t));
	mutex_init(&pkevp->portkev_lock, NULL, MUTEX_DEFAULT, NULL);
	pkevp->portkev_flags = flags;
	pkevp->portkev_port = pp;
	pkevp->portkev_source = source;
	pkevp->portkev_pid = curproc->p_pid;
	*pkevpp = pkevp;
	return (0);
}
开发者ID:MatiasNAmendola,项目名称:AuroraUX-SunOS,代码行数:35,代码来源:port_subr.c


示例9: port_close_sourcefd

/* ARGSUSED */
static void
port_close_sourcefd(void *arg, int port, pid_t pid, int lastclose)
{
	port_t		*pp = arg;
	port_fdcache_t	*pcp;
	portfd_t	**hashtbl;
	polldat_t	*pdp;
	polldat_t	*pdpnext;
	int		index;

	pcp = pp->port_queue.portq_pcp;
	if (pcp == NULL)
		/* no cache available -> nothing to do */
		return;

	mutex_enter(&pcp->pc_lock);
	/*
	 * Scan the cache and free all allocated portfd_t and port_kevent_t
	 * structures.
	 */
	hashtbl = pcp->pc_hash;
	for (index = 0; index < pcp->pc_hashsize; index++) {
		for (pdp = PFTOD(hashtbl[index]); pdp != NULL; pdp = pdpnext) {
			pdpnext = pdp->pd_hashnext;
			if (pid == pdp->pd_portev->portkev_pid) {
				/*
				 * remove polldat + port_event_t from cache
				 * only when current process did the
				 * association.
				 */
				port_remove_portfd(pdp, pcp);
			}
		}
	}
	if (lastclose) {
		/*
		 * Wait for all the portfd's to be freed.
		 * The remaining portfd_t's are the once we did not
		 * free in port_remove_portfd since some other thread
		 * is closing the fd. These threads will free the portfd_t's
		 * once we drop the pc_lock mutex.
		 */
		while (pcp->pc_fdcount) {
			(void) cv_wait_sig(&pcp->pc_lclosecv, &pcp->pc_lock);
		}
		/* event port vnode will be destroyed -> remove everything */
		pp->port_queue.portq_pcp = NULL;
	}
	mutex_exit(&pcp->pc_lock);
	/*
	 * last close:
	 * pollwakeup() can not further interact with this cache
	 * (all polldat structs are removed from pollhead entries).
	 */
	if (lastclose)
		port_pcache_destroy(pcp);
}
开发者ID:andreiw,项目名称:polaris,代码行数:58,代码来源:port_fd.c


示例10: xb_read

int
xb_read(void *data, unsigned len)
{
	volatile struct xenstore_domain_interface *intf =
	    xs_domain_interface(xb_addr);
	XENSTORE_RING_IDX cons, prod;
	extern int do_polled_io;

	while (len != 0) {
		unsigned int avail;
		const char *src;

		mutex_enter(&xb_wait_lock);
		while (intf->rsp_cons == intf->rsp_prod) {
			if (interrupts_unleashed && !do_polled_io) {
				if (cv_wait_sig(&xb_wait_cv,
				    &xb_wait_lock) == 0) {
					mutex_exit(&xb_wait_lock);
					return (EINTR);
				}
			} else { /* polled mode needed for early probes */
				(void) HYPERVISOR_yield();
			}
		}
		mutex_exit(&xb_wait_lock);
		/* Read indexes, then verify. */
		cons = intf->rsp_cons;
		prod = intf->rsp_prod;
		membar_enter();
		if (!check_indexes(cons, prod))
			return (EIO);

		src = get_input_chunk(cons, prod, (char *)intf->rsp, &avail);
		if (avail == 0)
			continue;
		if (avail > len)
			avail = len;

		/* We must read header before we read data. */
		membar_consumer();

		(void) memcpy(data, src, avail);
		data = (void *)((uintptr_t)data + avail);
		len -= avail;

		/* Other side must not see free space until we've copied out */
		membar_enter();
		intf->rsp_cons += avail;

		/* Implies mb(): they will see new header. */
		ec_notify_via_evtchn(xen_info->store_evtchn);
	}

	return (0);
}
开发者ID:MatiasNAmendola,项目名称:AuroraUX-SunOS,代码行数:55,代码来源:xenbus_comms.c


示例11: ev_read

/*
 * User-level interface: read, select.
 * (User cannot write an event queue.)
 */
int
ev_read(struct evvar *ev, struct uio *uio, int flags)
{
	int n, cnt, put, error;

	/*
	 * Make sure we can return at least 1.
	 */
	if (uio->uio_resid < sizeof(struct firm_event))
		return (EMSGSIZE);	/* ??? */
	mutex_enter(ev->ev_lock);
	while (ev->ev_get == ev->ev_put) {
		if (flags & IO_NDELAY) {
			mutex_exit(ev->ev_lock);
			return (EWOULDBLOCK);
		}
		ev->ev_wanted = true;
		error = cv_wait_sig(&ev->ev_cv, ev->ev_lock);
		if (error != 0) {
			mutex_exit(ev->ev_lock);
			return (error);
		}
	}
	/*
	 * Move firm_events from tail end of queue (there is at least one
	 * there).
	 */
	if (ev->ev_put < ev->ev_get)
		cnt = EV_QSIZE - ev->ev_get;	/* events in [get..QSIZE) */
	else
		cnt = ev->ev_put - ev->ev_get;	/* events in [get..put) */
	put = ev->ev_put;
	mutex_exit(ev->ev_lock);
	n = howmany(uio->uio_resid, sizeof(struct firm_event));
	if (cnt > n)
		cnt = n;
	error = uiomove((void *)&ev->ev_q[ev->ev_get],
	    cnt * sizeof(struct firm_event), uio);
	n -= cnt;
	/*
	 * If we do not wrap to 0, used up all our space, or had an error,
	 * stop.  Otherwise move from front of queue to put index, if there
	 * is anything there to move.
	 */
	if ((ev->ev_get = (ev->ev_get + cnt) % EV_QSIZE) != 0 ||
	    n == 0 || error || (cnt = put) == 0)
		return (error);
	if (cnt > n)
		cnt = n;
	error = uiomove((void *)&ev->ev_q[0],
	    cnt * sizeof(struct firm_event), uio);
	ev->ev_get = cnt;
	return (error);
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:58,代码来源:event.c


示例12: HgfsGetNewReq

HgfsReq *
HgfsGetNewReq(HgfsSuperInfo *sip)       // IN: Superinfo containing free list
{
   HgfsReq *newReq;

   DEBUG(VM_DEBUG_REQUEST, "HgfsGetNewReq().\n");

   ASSERT(sip);

   /*
    * Here we atomically get the next free request from the free list and set
    * that request's state to ALLOCATED.
    */
   mutex_enter(&sip->reqFreeMutex);

   /* Wait for a request structure if there aren't any free */
   while (HgfsListIsEmpty(&sip->reqFreeList)) {
      /*
       * If the list is empty, we wait on the condition variable which is
       * unconditionally signaled whenever a request is destroyed.
       */
      if (cv_wait_sig(&sip->reqFreeCondVar, &sip->reqFreeMutex) == 0) {
         /*
          * We were interrupted while waiting for a request, so we must return
          * NULL and release the mutex.
          */
         newReq = NULL;
         goto out;
      }
   }

   newReq = HGFS_FREE_REQ_LIST_HEAD(sip);

   HgfsDebugPrintReq("HgfsGetNewReq", newReq);

   /* Failure of these indicates error in program's logic */
   ASSERT(newReq && newReq->state == HGFS_REQ_UNUSED);

   /* Take request off the free list and indicate it has been ALLOCATED */
   DblLnkLst_Unlink1(&newReq->listNode);
   newReq->state = HGFS_REQ_ALLOCATED;

   /* Clear packet of request before allocating to clients. */
   bzero(newReq->packet, sizeof newReq->packet);

   DEBUG(VM_DEBUG_LIST, "Dequeued from free list: %s", newReq->packet);
   HgfsDebugPrintReqList(&sip->reqFreeList);

out:
   mutex_exit(&sip->reqFreeMutex);

   DEBUG(VM_DEBUG_REQUEST, "HgfsGetNewReq() done.\n");
   return newReq;
}
开发者ID:AlissonGiron,项目名称:open-vm-tools,代码行数:54,代码来源:request.c


示例13: xb_write

int
xb_write(const void *data, unsigned len)
{
	volatile struct xenstore_domain_interface *intf =
	    xs_domain_interface(xb_addr);
	XENSTORE_RING_IDX cons, prod;
	extern int do_polled_io;

	while (len != 0) {
		void *dst;
		unsigned int avail;

		mutex_enter(&xb_wait_lock);
		while ((intf->req_prod - intf->req_cons) ==
		    XENSTORE_RING_SIZE) {
			if (interrupts_unleashed && !do_polled_io) {
				if (cv_wait_sig(&xb_wait_cv,
				    &xb_wait_lock) == 0) {
					mutex_exit(&xb_wait_lock);
					return (EINTR);
				}
			} else { /* polled mode needed for early probes */
				(void) HYPERVISOR_yield();
			}
		}
		mutex_exit(&xb_wait_lock);
		/* Read indexes, then verify. */
		cons = intf->req_cons;
		prod = intf->req_prod;
		membar_enter();
		if (!check_indexes(cons, prod))
			return (EIO);

		dst = get_output_chunk(cons, prod, (char *)intf->req, &avail);
		if (avail == 0)
			continue;
		if (avail > len)
			avail = len;

		(void) memcpy(dst, data, avail);
		data = (void *)((uintptr_t)data + avail);
		len -= avail;

		/* Other side must not see new header until data is there. */
		membar_producer();
		intf->req_prod += avail;

		/* This implies mb() before other side sees interrupt. */
		ec_notify_via_evtchn(xen_info->store_evtchn);
	}

	return (0);
}
开发者ID:MatiasNAmendola,项目名称:AuroraUX-SunOS,代码行数:53,代码来源:xenbus_comms.c


示例14: sigqueue

/*
 * The handling of small unions, like the sigval argument to sigqueue,
 * is architecture dependent.  We have adopted the convention that the
 * value itself is passed in the storage which crosses the kernel
 * protection boundary.  This procedure will accept a scalar argument,
 * and store it in the appropriate value member of the sigsend_t structure.
 */
int
sigqueue(pid_t pid, int sig, /* union sigval */ void *value,
	int si_code, int block)
{
	int error;
	sigsend_t v;
	sigqhdr_t *sqh;
	proc_t *p = curproc;

	/* The si_code value must indicate the signal will be queued */
	if (pid <= 0 || !sigwillqueue(sig, si_code))
		return (set_errno(EINVAL));

	if ((sqh = p->p_sigqhdr) == NULL) {
		/* Allocate sigqueue pool first time */
		sqh = sigqhdralloc(sizeof (sigqueue_t), _SIGQUEUE_MAX);
		mutex_enter(&p->p_lock);
		if (p->p_sigqhdr == NULL) {
			/* hang the pool head on proc */
			p->p_sigqhdr = sqh;
		} else {
			/* another lwp allocated the pool, free ours */
			sigqhdrfree(sqh);
			sqh = p->p_sigqhdr;
		}
		mutex_exit(&p->p_lock);
	}

	do {
		bzero(&v, sizeof (v));
		v.sig = sig;
		v.checkperm = 1;
		v.sicode = si_code;
		v.value.sival_ptr = value;
		if ((error = sigqkill(pid, &v)) != EAGAIN || !block)
			break;
		/* block waiting for another chance to allocate a sigqueue_t */
		mutex_enter(&sqh->sqb_lock);
		while (sqh->sqb_count == 0) {
			if (!cv_wait_sig(&sqh->sqb_cv, &sqh->sqb_lock)) {
				error = EINTR;
				break;
			}
		}
		mutex_exit(&sqh->sqb_lock);
	} while (error == EAGAIN);

	if (error)
		return (set_errno(error));
	return (0);
}
开发者ID:andreiw,项目名称:polaris,代码行数:58,代码来源:sigqueue.c


示例15: sfxge_mcdi_acquire

/* Acquire exclusive access to MCDI for the duration of a request. */
static void
sfxge_mcdi_acquire(struct sfxge_mcdi *mcdi)
{

	mtx_lock(&mcdi->lock);
	KASSERT(mcdi->state != SFXGE_MCDI_UNINITIALIZED,
	    ("MCDI not initialized"));

	while (mcdi->state != SFXGE_MCDI_INITIALIZED)
		(void)cv_wait_sig(&mcdi->cv, &mcdi->lock);
	mcdi->state = SFXGE_MCDI_BUSY;

	mtx_unlock(&mcdi->lock);
}
开发者ID:dcui,项目名称:FreeBSD-9.3_kernel,代码行数:15,代码来源:sfxge_mcdi.c


示例16: cv_timedwait

int
cv_timedwait(kcondvar_t *cv, kmutex_t *mtx, int ticks)
{
	struct timespec ts;
	extern int hz;
	int rv;

	if (ticks == 0) {
		rv = cv_wait_sig(cv, mtx);
	} else {
		ts.tv_sec = ticks / hz;
		ts.tv_nsec = (ticks % hz) * (1000000000/hz);
		rv = docvwait(cv, mtx, &ts);
	}

	return rv;
}
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:17,代码来源:locks.c


示例17: afs_osi_SleepSig

int
afs_osi_SleepSig(void *event)
{
    struct afs_event *evp;
    int seq, code = 0;

    evp = afs_getevent(event);
    seq = evp->seq;
    while (seq == evp->seq) {
	AFS_ASSERT_GLOCK();
	if (cv_wait_sig(&evp->cond, &afs_global_lock) == 0) {
	    code = EINTR;
	    break;
	}
    }
    relevent(evp);
    return code;
}
开发者ID:bagdxk,项目名称:openafs,代码行数:18,代码来源:osi_sleep.c


示例18: fuse_queue_request_wait

int
fuse_queue_request_wait(fuse_session_t *se, fuse_msg_node_t *req_p)
{
	int err = 0;
	int interrupted = 0;

	req_p->frd_on_request_complete = frd_on_request_complete_wakeup;
	fuse_queue_request_nowait(se, req_p);

	FUSE_SESSION_MUTEX_LOCK(se);

	while (req_p->fmn_state != FUSE_MSG_STATE_DONE) {
		if (cv_wait_sig(&req_p->fmn_cv, &se->session_mutx) != 0) {
			continue;
		} else {
			interrupted = 1;
			break;
		}
	}
	if (interrupted == 0) {
		req_p->opdata.outdata = req_p->opdata.iovbuf.base;
		FUSE_SESSION_MUTEX_UNLOCK(se);
		return (err);
	}

	DTRACE_PROBE3(fuse_queue_request_wait_err_no_response,
	    char *, "no response from daemon",
	    fuse_session_t *, se, fuse_msg_node_t *, req_p);

	if (req_p->fmn_state == FUSE_MSG_STATE_DONE) {
		goto err;
	}
	if (req_p->fmn_state != FUSE_MSG_STATE_QUEUE)
		req_p->fmn_state = FUSE_MSG_STATE_SIG;

	while (req_p->fmn_state != FUSE_MSG_STATE_DONE)
		cv_wait(&req_p->fmn_cv, &se->session_mutx);
err:
	req_p->opdata.outdata = NULL;
	err = EINTR;
	FUSE_SESSION_MUTEX_UNLOCK(se);

	return (err);
}
开发者ID:alhazred,项目名称:illumos-sshfs,代码行数:44,代码来源:fuse_queue.c


示例19: wusb_df_serialize_access

/*
 * wusb_df_serialize_access:
 *    Get the serial synchronization object before returning.
 *
 * Arguments:
 *    wusb_dfp - Pointer to wusb_df state structure
 *    waitsig - Set to:
 *	WUSB_DF_SER_SIG - to wait such that a signal can interrupt
 *	WUSB_DF_SER_NOSIG - to wait such that a signal cannot interrupt
 */
static int
wusb_df_serialize_access(wusb_df_state_t *wusb_dfp, boolean_t waitsig)
{
	int rval = 1;

	ASSERT(mutex_owned(&wusb_dfp->wusb_df_mutex));

	while (wusb_dfp->wusb_df_serial_inuse) {
		if (waitsig == WUSB_DF_SER_SIG) {
			rval = cv_wait_sig(&wusb_dfp->wusb_df_serial_cv,
			    &wusb_dfp->wusb_df_mutex);
		} else {
			cv_wait(&wusb_dfp->wusb_df_serial_cv,
			    &wusb_dfp->wusb_df_mutex);
		}
	}
	wusb_dfp->wusb_df_serial_inuse = B_TRUE;

	return (rval);
}
开发者ID:MatiasNAmendola,项目名称:AuroraUX-SunOS,代码行数:30,代码来源:wusb_df.c


示例20: lx_ptm_read_start

static int
lx_ptm_read_start(dev_t dev)
{
	lx_ptm_ops_t	*lpo = lx_ptm_lpo_lookup(DEVT_TO_INDEX(dev));

	mutex_enter(&lpo->lpo_rops_lock);
	ASSERT(lpo->lpo_rops >= 0);

	/* Wait for other read operations to finish */
	while (lpo->lpo_rops != 0) {
		if (cv_wait_sig(&lpo->lpo_rops_cv, &lpo->lpo_rops_lock) == 0) {
			mutex_exit(&lpo->lpo_rops_lock);
			return (-1);
		}
	}

	/* Start a read operation */
	VERIFY(++lpo->lpo_rops == 1);
	mutex_exit(&lpo->lpo_rops_lock);
	return (0);
}
开发者ID:MatiasNAmendola,项目名称:AuroraUX-SunOS,代码行数:21,代码来源:lx_ptm.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cvar函数代码示例发布时间:2022-05-30
下一篇:
C++ cv_wait函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap