您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ xnlock_put_irqrestore函数代码示例

51自学网 2021-06-03 11:50:21
  C++
这篇教程C++ xnlock_put_irqrestore函数代码示例写得很实用,希望能帮到您。

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

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

示例1: xnselector_destroy

/** * Destroy a selector block. * * All bindings with file descriptor are destroyed. * * @param selector the selector block to be destroyed */void xnselector_destroy(struct xnselector *selector){	spl_t s;	inith(&selector->destroy_link);	xnlock_get_irqsave(&nklock, s);	appendq(&xnselectors, &selector->destroy_link);	xnlock_put_irqrestore(&nklock, s);	rthal_apc_schedule(xnselect_apc);}
开发者ID:ArcEye,项目名称:RTAI,代码行数:17,


示例2: pthread_mutexattr_getpshared

/** * Get the process-shared attribute of a mutex attributes object. * * This service stores, at the address @a pshared, the value of the @a pshared * attribute in the mutex attributes object @a attr. * * The @a pashared attribute may only be one of @a PTHREAD_PROCESS_PRIVATE or * @a PTHREAD_PROCESS_SHARED. See pthread_mutexattr_setpshared() for the meaning * of these two constants. * * @param attr an initialized mutex attributes object; * * @param pshared address where the value of the @a pshared attribute will be * stored on success. * * @return 0 on success; * @return an error number if: * - EINVAL, the @a pshared address is invalid; * - EINVAL, the mutex attributes object @a attr is invalid. * * @see * <a href="http://www.opengroup.org/onlinepubs/000095399/functions/pthread_mutexattr_getpshared.html"> * Specification.</a> * */int pthread_mutexattr_getpshared(const pthread_mutexattr_t *attr, int *pshared){	spl_t s;	if (!pshared || !attr)		return EINVAL;	xnlock_get_irqsave(&nklock, s);	if (!pse51_obj_active(attr,PSE51_MUTEX_ATTR_MAGIC,pthread_mutexattr_t)) {		xnlock_put_irqrestore(&nklock, s);		return EINVAL;	}	*pshared = attr->pshared;	xnlock_put_irqrestore(&nklock, s);	return 0;}
开发者ID:JackieXie168,项目名称:xenomai,代码行数:45,


示例3: pthread_mutexattr_gettype

/** * Get the mutex type attribute from a mutex attributes object. * * This service stores, at the address @a type, the value of the @a type * attribute in the mutex attributes object @a attr. * * See pthread_mutex_lock() and pthread_mutex_unlock() documentations for a * description of the values of the @a type attribute and their effect on a * mutex. * * @param attr an initialized mutex attributes object, * * @param type address where the @a type attribute value will be stored on * success. * * @return 0 on sucess, * @return an error number if: * - EINVAL, the @a type address is invalid; * - EINVAL, the mutex attributes object @a attr is invalid. * * @see * <a href="http://www.opengroup.org/onlinepubs/000095399/functions/pthread_mutexattr_gettype.html"> * Specification.</a> * */int pthread_mutexattr_gettype(const pthread_mutexattr_t * attr, int *type){	spl_t s;	if (!type || !attr)		return EINVAL;	xnlock_get_irqsave(&nklock, s);	if (!pse51_obj_active(attr,PSE51_MUTEX_ATTR_MAGIC,pthread_mutexattr_t)) {		xnlock_put_irqrestore(&nklock, s);		return EINVAL;	}	*type = attr->type;	xnlock_put_irqrestore(&nklock, s);	return 0;}
开发者ID:JackieXie168,项目名称:xenomai,代码行数:45,


示例4: rt_buffer_create

int rt_buffer_create(RT_BUFFER *bf, const char *name, size_t bufsz, int mode){	int ret = 0;	spl_t s;	if (xnpod_asynch_p())		return -EPERM;	if (bufsz == 0)		return -EINVAL;	bf->bufmem = xnarch_alloc_host_mem(bufsz);	if (bf->bufmem == NULL)		return -ENOMEM;	xnsynch_init(&bf->isynch_base, mode & B_PRIO, NULL);	xnsynch_init(&bf->osynch_base, mode & B_PRIO, NULL);	bf->handle = 0;	/* i.e. (still) unregistered buffer. */	xnobject_copy_name(bf->name, name);	inith(&bf->rlink);	bf->rqueue = &xeno_get_rholder()->bufferq;	xnlock_get_irqsave(&nklock, s);	appendq(bf->rqueue, &bf->rlink);	xnlock_put_irqrestore(&nklock, s);	bf->mode = mode;	bf->bufsz = bufsz;	bf->rdoff = 0;	bf->wroff = 0;	bf->fillsz = 0;	bf->rdtoken = 0;	bf->wrtoken = 0;#ifndef __XENO_SIM__	bf->cpid = 0;#endif	bf->magic = XENO_BUFFER_MAGIC;	/*	 * <!> Since xnregister_enter() may reschedule, only register	 * complete objects, so that the registry cannot return	 * handles to half-baked objects...	 */	if (name) {		ret = xnregistry_enter(bf->name, bf, &bf->handle,				       &__buffer_pnode.node);		if (ret)			rt_buffer_delete(bf);	}	return ret;}
开发者ID:BhargavKola,项目名称:xenomai-forge,代码行数:54,


示例5: openfd_show

static int openfd_show(struct xnvfile_regular_iterator *it, void *data){	struct rtdm_dev_context *context;	struct rtdm_device *device;	struct rtdm_process owner;	int close_lock_count, fd;	spl_t s;	if (data == NULL) {		xnvfile_puts(it, "Index/tLocked/tDevice/t/t/t/tOwner [PID]/n");		return 0;	}	fd = (int)it->pos - 1;	xnlock_get_irqsave(&rt_fildes_lock, s);	context = fildes_table[fd].context;	if (context == NULL) {		xnlock_put_irqrestore(&rt_fildes_lock, s);		return VFILE_SEQ_SKIP;	}	close_lock_count = atomic_read(&context->close_lock_count);	device = context->device;	if (context->reserved.owner)		memcpy(&owner, context->reserved.owner, sizeof(owner));	else {		strcpy(owner.name, "<kernel>");		owner.pid = -1;	}	xnlock_put_irqrestore(&rt_fildes_lock, s);	xnvfile_printf(it, "%d/t%d/t%-31s %s [%d]/n", fd,		       close_lock_count,		       (device->device_flags & RTDM_NAMED_DEVICE) ?		       device->device_name : device->proc_name,		       owner.name, owner.pid);	return 0;}
开发者ID:ArcEye,项目名称:RTAI,代码行数:41,


示例6: pthread_mutexattr_getprotocol

/** * Get the protocol attribute from a mutex attributes object. * * This service stores, at the address @a proto, the value of the @a protocol * attribute in the mutex attributes object @a attr. * * The @a protcol attribute may only be one of @a PTHREAD_PRIO_NONE or @a * PTHREAD_PRIO_INHERIT. See pthread_mutexattr_setprotocol() for the meaning of * these two constants. * * @param attr an initialized mutex attributes object; * * @param proto address where the value of the @a protocol attribute will be * stored on success. * * @return 0 on success, * @return an error number if: * - EINVAL, the @a proto address is invalid; * - EINVAL, the mutex attributes object @a attr is invalid. * * @see * <a href="http://www.opengroup.org/onlinepubs/000095399/functions/pthread_mutexattr_getprotocol.html"> * Specification.</a> * */static inline intpthread_mutexattr_getprotocol(const pthread_mutexattr_t * attr, int *proto){	spl_t s;	if (!proto || !attr)		return EINVAL;	xnlock_get_irqsave(&nklock, s);	if (!cobalt_obj_active(attr,COBALT_MUTEX_ATTR_MAGIC,pthread_mutexattr_t)) {		xnlock_put_irqrestore(&nklock, s);		return EINVAL;	}	*proto = attr->protocol;	xnlock_put_irqrestore(&nklock, s);	return 0;}
开发者ID:Lmaths,项目名称:xenomai-forge,代码行数:46,


示例7: msgQDelete

STATUS msgQDelete(MSG_Q_ID qid){	wind_msgq_t *queue;	spl_t s;	check_NOT_ISR_CALLABLE(return ERROR);	xnlock_get_irqsave(&nklock, s);	check_OBJ_ID_ERROR(qid, wind_msgq_t, queue, WIND_MSGQ_MAGIC,			   goto error);	if (msgq_destroy_internal(queue) == XNSYNCH_RESCHED)		xnpod_schedule();	xnlock_put_irqrestore(&nklock, s);	return OK;      error:	xnlock_put_irqrestore(&nklock, s);	return ERROR;}
开发者ID:chrmorais,项目名称:miniemc2,代码行数:21,


示例8: msgQNumMsgs

int msgQNumMsgs(MSG_Q_ID qid){	wind_msgq_t *queue;	int result;	spl_t s;	xnlock_get_irqsave(&nklock, s);	check_OBJ_ID_ERROR(qid, wind_msgq_t, queue, WIND_MSGQ_MAGIC,			   goto error);	result = queue->msgq.elems;	xnlock_put_irqrestore(&nklock, s);	return result;      error:	xnlock_put_irqrestore(&nklock, s);	return ERROR;}
开发者ID:chrmorais,项目名称:miniemc2,代码行数:21,


示例9: xnpipe_release

static int xnpipe_release(struct inode *inode, struct file *file){	struct xnpipe_state *state = file->private_data;	spl_t s;	xnlock_get_irqsave(&nklock, s);	xnpipe_dequeue_all(state, XNPIPE_USER_WREAD);	xnpipe_dequeue_all(state, XNPIPE_USER_WSYNC);	if (testbits(state->status, XNPIPE_KERN_CONN)) {		/* Unblock waiters. */		if (xnsynch_nsleepers(&state->synchbase) > 0) {			xnsynch_flush(&state->synchbase, XNRMID);			xnpod_schedule();		}	}	if (state->ops.input)		state->ops.input(NULL, -EPIPE, state->xstate);	if (state->asyncq) {	/* Clear the async queue */		removeq(&xnpipe_asyncq, &state->alink);		__clrbits(state->status, XNPIPE_USER_SIGIO);		xnlock_put_irqrestore(&nklock, s);		fasync_helper(-1, file, 0, &state->asyncq);		xnlock_get_irqsave(&nklock, s);	}	xnpipe_cleanup_user_conn(state, s);	/*	 * The extra state may not be available from now on, if	 * xnpipe_disconnect() entered lingering close before we got	 * there; so calling xnpipe_cleanup_user_conn() should be the	 * last thing we do.	 */	xnlock_put_irqrestore(&nklock, s);	return 0;}
开发者ID:JackieXie168,项目名称:xenomai,代码行数:40,


示例10: pthread_once

/** * Execute an initialization routine. * * This service may be used by libraries which need an initialization function * to be called only once. * * The function @a init_routine will only be called, with no argument, the first * time this service is called specifying the address @a once. * * @return 0 on success; * @return an error number if: * - EINVAL, the object pointed to by @a once is invalid (it must have been *   initialized with PTHREAD_ONCE_INIT). * * @see * <a href="http://www.opengroup.org/onlinepubs/000095399/functions/pthread_once.html"> * Specification.</a> * */int pthread_once(pthread_once_t * once, void (*init_routine) (void)){	spl_t s;	xnlock_get_irqsave(&nklock, s);	if (!pse51_obj_active(once, PSE51_ONCE_MAGIC, pthread_once_t)) {		xnlock_put_irqrestore(&nklock, s);		return EINVAL;	}	if (!once->routine_called) {		init_routine();		/* If the calling thread is canceled while executing init_routine,		   routine_called will not be set to 1. */		once->routine_called = 1;	}	xnlock_put_irqrestore(&nklock, s);	return 0;}
开发者ID:BhargavKola,项目名称:xenomai-forge,代码行数:41,


示例11: xnsynch_fastlock_p

struct xnthread *xnsynch_release(struct xnsynch *synch){	const int use_fastlock = xnsynch_fastlock_p(synch);	struct xnthread *newowner, *lastowner;	xnhandle_t lastownerh, newownerh;	struct xnpholder *holder;	spl_t s;	XENO_BUGON(NUCLEUS, !testbits(synch->status, XNSYNCH_OWNER));	lastownerh = xnthread_handle(xnpod_current_thread());	if (use_fastlock &&	    likely(xnsynch_fast_release(xnsynch_fastlock(synch), lastownerh)))		return NULL;	xnlock_get_irqsave(&nklock, s);	trace_mark(xn_nucleus, synch_release, "synch %p", synch);	holder = getpq(&synch->pendq);	if (holder) {		newowner = link2thread(holder, plink);		newowner->wchan = NULL;		newowner->wwake = synch;		lastowner = synch->owner;		synch->owner = newowner;		xnthread_set_info(newowner, XNWAKEN);		xnpod_resume_thread(newowner, XNPEND);		if (testbits(synch->status, XNSYNCH_CLAIMED))			xnsynch_clear_boost(synch, lastowner);		newownerh = xnsynch_fast_set_claimed(xnthread_handle(newowner),						     xnsynch_pended_p(synch));	} else {		newowner = NULL;		synch->owner = NULL;		newownerh = XN_NO_HANDLE;	}	if (use_fastlock) {		xnarch_atomic_t *lockp = xnsynch_fastlock(synch);		xnarch_atomic_set(lockp, newownerh);	}	xnlock_put_irqrestore(&nklock, s);	xnarch_post_graph_if(synch, 0, emptypq_p(&synch->pendq));	return newowner;}
开发者ID:chrmorais,项目名称:miniemc2,代码行数:51,


示例12: program_htick_shot

/** * @internal * @fn static int program_htick_shot(unsigned long delay, struct clock_event_device *cdev) * * @brief Program next host tick as a Xenomai timer event. * * Program the next shot for the host tick on the current CPU. * Emulation is done using a nucleus timer attached to the master * timebase. * * @param delay The time delta from the current date to the next tick, * expressed as a count of nanoseconds. * * @param cdev An pointer to the clock device which notifies us. * * @coretags{unrestricted} */static int program_htick_shot(unsigned long delay,			      struct clock_event_device *cdev){	struct xnsched *sched;	int ret;	spl_t s;	xnlock_get_irqsave(&nklock, s);	sched = xnsched_current();	ret = xntimer_start(&sched->htimer, delay, XN_INFINITE, XN_RELATIVE);	xnlock_put_irqrestore(&nklock, s);	return ret ? -ETIME : 0;}
开发者ID:ChunHungLiu,项目名称:xenomai,代码行数:31,


示例13: rt_event_signal

int rt_event_signal(RT_EVENT *event, unsigned long mask){	xnpholder_t *holder, *nholder;	int err = 0, resched = 0;	spl_t s;	xnlock_get_irqsave(&nklock, s);	event = xeno_h2obj_validate(event, XENO_EVENT_MAGIC, RT_EVENT);	if (!event) {		err = xeno_handle_error(event, XENO_EVENT_MAGIC, RT_EVENT);		goto unlock_and_exit;	}	/* Post the flags. */	event->value |= mask;	/* And wakeup any sleeper having its request fulfilled. */	nholder = getheadpq(xnsynch_wait_queue(&event->synch_base));	while ((holder = nholder) != NULL) {		RT_TASK *sleeper = thread2rtask(link2thread(holder, plink));		int mode = sleeper->wait_args.event.mode;		unsigned long bits = sleeper->wait_args.event.mask;		if (((mode & EV_ANY) && (bits & event->value) != 0) ||		    (!(mode & EV_ANY) && ((bits & event->value) == bits))) {			sleeper->wait_args.event.mask = (bits & event->value);			nholder =			    xnsynch_wakeup_this_sleeper(&event->synch_base,							holder);			resched = 1;		} else			nholder =			    nextpq(xnsynch_wait_queue(&event->synch_base),				   holder);	}	if (resched)		xnpod_schedule();      unlock_and_exit:	xnlock_put_irqrestore(&nklock, s);	return err;}
开发者ID:chrmorais,项目名称:miniemc2,代码行数:50,


示例14: xnpipe_fasync

static int xnpipe_fasync(int fd, struct file *file, int on){	struct xnpipe_state *state = file->private_data;	int ret, queued;	spl_t s;	queued = (state->asyncq != NULL);	ret = fasync_helper(fd, file, on, &state->asyncq);	if (state->asyncq) {		if (!queued) {			xnlock_get_irqsave(&nklock, s);			appendq(&xnpipe_asyncq, &state->alink);			xnlock_put_irqrestore(&nklock, s);		}	} else if (queued) {		xnlock_get_irqsave(&nklock, s);		removeq(&xnpipe_asyncq, &state->alink);		xnlock_put_irqrestore(&nklock, s);	}	return ret;}
开发者ID:JackieXie168,项目名称:xenomai,代码行数:23,


示例15: pthread_mutexattr_setprotocol

/** * Set the protocol attribute of a mutex attributes object. * * This service set the @a type attribute of the mutex attributes object * @a attr. * * @param attr an initialized mutex attributes object, * * @param proto value of the @a protocol attribute, may be one of: * - PTHREAD_PRIO_NONE, meaning that a mutex created with the attributes object *   @a attr will not follow any priority protocol; * - PTHREAD_PRIO_INHERIT, meaning that a mutex created with the attributes *   object @a attr, will follow the priority inheritance protocol. * * The value PTHREAD_PRIO_PROTECT (priority ceiling protocol) is unsupported. * * @return 0 on success, * @return an error number if: * - EINVAL, the mutex attributes object @a attr is invalid; * - EOPNOTSUPP, the value of @a proto is unsupported; * - EINVAL, the value of @a proto is invalid. * * @see * <a href="http://www.opengroup.org/onlinepubs/000095399/functions/pthread_mutexattr_setprotocol.html"> * Specification.</a> * */static inline intpthread_mutexattr_setprotocol(pthread_mutexattr_t * attr, int proto){	spl_t s;	if (!attr)		return EINVAL;	xnlock_get_irqsave(&nklock, s);	if (!cobalt_obj_active(attr,COBALT_MUTEX_ATTR_MAGIC,pthread_mutexattr_t)) {		xnlock_put_irqrestore(&nklock, s);		return EINVAL;	}	switch (proto) {	default:		xnlock_put_irqrestore(&nklock, s);		return EINVAL;	case PTHREAD_PRIO_PROTECT:		xnlock_put_irqrestore(&nklock, s);		return EOPNOTSUPP;	case PTHREAD_PRIO_NONE:	case PTHREAD_PRIO_INHERIT:		break;	}	attr->protocol = proto;	xnlock_put_irqrestore(&nklock, s);	return 0;}
开发者ID:Lmaths,项目名称:xenomai-forge,代码行数:64,


示例16: __xntimer_init

void __xntimer_init(struct xntimer *timer,		    struct xnclock *clock,		    void (*handler)(struct xntimer *timer),		    struct xnsched *sched,		    int flags){	spl_t s __maybe_unused;	int cpu;#ifdef CONFIG_XENO_OPT_EXTCLOCK	timer->clock = clock;#endif	xntimerh_init(&timer->aplink);	xntimerh_date(&timer->aplink) = XN_INFINITE;	xntimer_set_priority(timer, XNTIMER_STDPRIO);	timer->status = (XNTIMER_DEQUEUED|(flags & XNTIMER_INIT_MASK));	timer->handler = handler;	timer->interval_ns = 0;	/*	 * Timers are affine to a scheduler slot, which is in turn	 * bound to a real-time CPU. If no scheduler affinity was	 * given, assign the timer to the scheduler slot of the	 * current CPU if real-time, otherwise default to the	 * scheduler slot of the first real-time CPU.	 */	if (sched)		timer->sched = sched;	else {		cpu = ipipe_processor_id();		if (!xnsched_supported_cpu(cpu))			cpu = first_cpu(xnsched_realtime_cpus);		timer->sched = xnsched_struct(cpu);	}#ifdef CONFIG_XENO_OPT_STATS#ifdef CONFIG_XENO_OPT_EXTCLOCK	timer->tracker = clock;#endif	ksformat(timer->name, XNOBJECT_NAME_LEN, "%d/%s",		 current->pid, current->comm);	xntimer_reset_stats(timer);	xnlock_get_irqsave(&nklock, s);	list_add_tail(&timer->next_stat, &clock->timerq);	clock->nrtimers++;	xnvfile_touch(&clock->timer_vfile);	xnlock_put_irqrestore(&nklock, s);#endif /* CONFIG_XENO_OPT_STATS */}
开发者ID:ChunHungLiu,项目名称:xenomai,代码行数:49,


示例17: sc_mcreate

int sc_mcreate(unsigned int opt, int *errp){	int bflags, mid;	vrtxmx_t *mx;	spl_t s;	switch (opt) {	case 0:		bflags = XNSYNCH_PRIO;		break;	case 1:		bflags = XNSYNCH_FIFO;		break;	case 2:		bflags = XNSYNCH_PRIO | XNSYNCH_PIP;		break;	default:		*errp = ER_IIP;		return 0;	}	mx = xnmalloc(sizeof(*mx));	if (mx == NULL) {		*errp = ER_NOCB;		return -1;	}	mid = xnmap_enter(vrtx_mx_idmap, -1, mx);	if (mid < 0) {		xnfree(mx);		return -1;	}	inith(&mx->link);	mx->mid = mid;	xnsynch_init(&mx->synchbase, bflags | XNSYNCH_DREORD | XNSYNCH_OWNER,		     NULL);	xnlock_get_irqsave(&nklock, s);	appendq(&vrtx_mx_q, &mx->link);	xnlock_put_irqrestore(&nklock, s);	sprintf(mx->name, "mx%d", mid);	xnregistry_enter(mx->name, mx, &mx->handle, &__mutex_pnode.node);	*errp = RET_OK;	return mid;}
开发者ID:TALABOULMA-Walid,项目名称:xenomai-2.6,代码行数:49,



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


C++ xnmalloc函数代码示例
C++ xnlock_get_irqsave函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。