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

C++ read_seqretry函数代码示例

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

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



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

示例1: route_lookup

unsigned long route_lookup(unsigned long addr)
{
	struct route_entry *rep;
	struct route_entry **repp;
	unsigned long ret;
	unsigned long s;

retry:							//\lnlbl{lookup:retry}
	s = read_seqbegin(&sl);				//\lnlbl{lookup:r_sqbegin}
	repp = &route_list.re_next;
	do {
		rep = READ_ONCE(*repp);
		if (rep == NULL) {
			if (read_seqretry(&sl, s))	//\lnlbl{lookup:r_sqretry1}
				goto retry;		//\lnlbl{lookup:goto_retry1}
			return ULONG_MAX;
		}
								//\fcvexclude
		/* Advance to next. */				//\fcvexclude
		repp = &rep->re_next;
	} while (rep->addr != addr);
	if (READ_ONCE(rep->re_freed))			//\lnlbl{lookup:chk_freed}
		abort();				//\lnlbl{lookup:abort}
	ret = rep->iface;
	if (read_seqretry(&sl, s))			//\lnlbl{lookup:r_sqretry2}
		goto retry;				//\lnlbl{lookup:goto_retry2}
	return ret;
}
开发者ID:pranith,项目名称:perfbook,代码行数:28,代码来源:route_seqlock.c


示例2: do_gettimeofday

void do_gettimeofday(struct timeval *tv)
{
	unsigned long seq;
	unsigned long usec, sec;
	unsigned long lost;

	do {
		seq = read_seqbegin(&xtime_lock);
		usec = get_timer_offset();

		lost = jiffies - wall_jiffies;
		if (lost)
			usec += lost * (1000000 / HZ);

		sec = xtime.tv_sec;
		usec += xtime.tv_nsec / 1000;
	} while (read_seqretry(&xtime_lock, seq));

	while (usec >= 1000000) {
		usec -= 1000000;
		sec++;
	}

	tv->tv_sec = sec;
	tv->tv_usec = usec;
}
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:26,代码来源:time.c


示例3: do_gettimeofday

/*
 * High res timers changes: First we want to use full nsec for all
 * the math to avoid the double round off (on the offset and xtime).
 * Second, we want to allow a boot with HRT turned off at boot time.
 * This will cause hrtimer_use to be false, and we then fall back to 
 * the old code.  We also shorten the xtime lock region and eliminate
 * the lost tick code as this kernel will never have lost ticks under
 * the lock (i.e. wall_jiffies will never differ from jiffies except
 * when the write xtime lock is held).
 */
void do_gettimeofday(struct timeval *tv)
{
	unsigned long seq;
	unsigned long sec, nsec, clk_nsec;
	unsigned long max_ntp_tick;

	do {
		seq = read_seqbegin(&xtime_lock);
#ifdef CONFIG_HIGH_RES_TIMERS
		if (hrtimer_use) 
			nsec = arch_cycle_to_nsec(get_arch_cycles(wall_jiffies));
		else 
#endif
			nsec = cur_timer->get_offset() * NSEC_PER_USEC;
		

		sec = xtime.tv_sec;
		clk_nsec = xtime.tv_nsec;
		max_ntp_tick = current_tick_length() >> (SHIFT_SCALE - 10);
	} while (read_seqretry(&xtime_lock, seq));

	/* ensure we don't advance beyond the current tick length */
	nsec = min(nsec, max_ntp_tick);

	nsec += clk_nsec;
				
	while (nsec >= NSEC_PER_SEC) {
		nsec -=  NSEC_PER_SEC;
		sec++;
	}

	tv->tv_sec = sec;
	tv->tv_usec = nsec / NSEC_PER_USEC;
}
开发者ID:JacksonZhangkun,项目名称:linux-2.6,代码行数:44,代码来源:time.c


示例4: do_gettimeofday

/*
 * This version of gettimeofday has near microsecond resolution.
 */
void do_gettimeofday(struct timeval *tv)
{
    unsigned long seq;
    unsigned long usec, sec;
    unsigned long max_ntp_tick = tick_usec - tickadj;

    do {
        seq = read_seqbegin(&xtime_lock);

        usec = do_gettimeoffset();

        /*
         * If time_adjust is negative then NTP is slowing the clock
         * so make sure not to go into next possible interval.
         * Better to lose some accuracy than have time go backwards..
         */
        if (unlikely(time_adjust < 0))
            usec = min(usec, max_ntp_tick);

        sec = xtime.tv_sec;
        usec += (xtime.tv_nsec / 1000);
    } while (read_seqretry(&xtime_lock, seq));

    while (usec >= 1000000) {
        usec -= 1000000;
        sec++;
    }

    tv->tv_sec = sec;
    tv->tv_usec = usec;
}
开发者ID:274914765,项目名称:C,代码行数:34,代码来源:time.c


示例5: ksnd_pcm_mtimestamp

/**
 * \brief Obtain last position update hi-res monotonic timestamp
 * \param pcm PCM handle
 * \param avail Number of available frames when timestamp was grabbed
 * \param mstamp Hi-res timestamp based on CLOCK_MONOTONIC rather then wall time.
 * \return 0 on success otherwise a negative error code
 *
 * This function is an extension to alsa-lib (which serves as a template for
 * all the ksound functions). However since all the in-kernel ksound clients
 * measure time using the monotonic clock this function is required if the
 * timestamp is to be meaningful.
 */
int ksnd_pcm_mtimestamp(ksnd_pcm_t *pcm, snd_pcm_uframes_t *avail, struct timespec *mstamp)
{
	unsigned long seq;
	int res;
	struct timespec tstamp;
	struct timespec tomono;
	do
	{
		seq = read_seqbegin(&xtime_lock);
		res = ksnd_pcm_htimestamp(pcm, avail, &tstamp);
		tomono = wall_to_monotonic;
	}
	while (read_seqretry(&xtime_lock, seq));
	if (res < 0)
		return res;
	mstamp->tv_sec = tstamp.tv_sec + tomono.tv_sec;
	mstamp->tv_nsec = tstamp.tv_nsec + tomono.tv_nsec;
	while (mstamp->tv_nsec >= NSEC_PER_SEC)
	{
		mstamp->tv_nsec -= NSEC_PER_SEC;
		++mstamp->tv_sec;
	}
	while (mstamp->tv_nsec < 0)
	{
		mstamp->tv_nsec += NSEC_PER_SEC;
		--mstamp->tv_sec;
	}
	return res;
}
开发者ID:Audioniek,项目名称:Fortis-4G,代码行数:41,代码来源:ksound-core.c


示例6: fb_counter_netrx

static int fb_counter_netrx(const struct fblock * const fb,
			    struct sk_buff * const skb,
			    enum path_type * const dir)
{
	int drop = 0;
	unsigned int seq;
	struct fb_counter_priv __percpu *fb_priv_cpu;

	fb_priv_cpu = this_cpu_ptr(rcu_dereference_raw(fb->private_data));
	prefetchw(skb->cb);
	do {
		seq = read_seqbegin(&fb_priv_cpu->lock);
		write_next_idp_to_skb(skb, fb->idp, fb_priv_cpu->port[*dir]);
		if (fb_priv_cpu->port[*dir] == IDP_UNKNOWN)
			drop = 1;
	} while (read_seqretry(&fb_priv_cpu->lock, seq));

	u64_stats_update_begin(&fb_priv_cpu->syncp);
	fb_priv_cpu->packets++;
	fb_priv_cpu->bytes += skb->len;
	u64_stats_update_end(&fb_priv_cpu->syncp);

	if (drop) {
		kfree_skb(skb);
		return PPE_DROPPED;
	}
	return PPE_SUCCESS;
}
开发者ID:digideskio,项目名称:lana,代码行数:28,代码来源:fb_counter.c


示例7: retrigger_next_event

/*
 * Retrigger next event is called after clock was set
 *
 * Called with interrupts disabled via on_each_cpu()
 */
static void retrigger_next_event(void *arg)
{
	struct hrtimer_cpu_base *base;
	struct timespec realtime_offset, wtm;
	unsigned long seq;

	if (!hrtimer_hres_active())
		return;

	do {
		seq = read_seqbegin(&xtime_lock);
		wtm = __get_wall_to_monotonic();
	} while (read_seqretry(&xtime_lock, seq));
	set_normalized_timespec(&realtime_offset, -wtm.tv_sec, -wtm.tv_nsec);

	base = &__get_cpu_var(hrtimer_bases);

	/* Adjust CLOCK_REALTIME offset */
	raw_spin_lock(&base->lock);
	base->clock_base[CLOCK_REALTIME].offset =
		timespec_to_ktime(realtime_offset);

	hrtimer_force_reprogram(base, 0);
	raw_spin_unlock(&base->lock);
}
开发者ID:mcr,项目名称:linux-2.6,代码行数:30,代码来源:hrtimer.c


示例8: bcm_fast_path_output

/* 
 * Send packets to output.
 */
static inline int bcm_fast_path_output(struct sk_buff *skb)
{
	int ret = 0;
	struct dst_entry *dst = skb_dst(skb);
	struct hh_cache *hh = dst->hh;

	if (hh) {
		unsigned seq;
		int hh_len;

		do {
			int hh_alen;
			seq = read_seqbegin(&hh->hh_lock);
			hh_len = hh->hh_len;
			hh_alen = HH_DATA_ALIGN(hh_len);
			memcpy(skb->data - hh_alen, hh->hh_data, hh_alen);
			} while (read_seqretry(&hh->hh_lock, seq));

			skb_push(skb, hh_len);
		ret = hh->hh_output(skb); 
		if (ret==1) 
			return 0; /* Don't return 1 */
	} else if (dst->neighbour) {
		ret = dst->neighbour->output(skb);  
		if (ret==1) 
			return 0; /* Don't return 1 */
	}
	return ret;
}
开发者ID:jhbsz,项目名称:DIR-850L_A1,代码行数:32,代码来源:bcm_nat.c


示例9: fb_udp_netrx_out

static int fb_udp_netrx_out(const struct fblock * const fb,
			    struct sk_buff * const skb)
{
	int fdrop = 0;
	idp_t next_fb;
	unsigned int seq;
	struct udphdr *hdr;
	struct fb_udp_priv *fb_priv;

	fb_priv = rcu_dereference_raw(fb->private_data);
	do {
		seq = read_seqbegin(&fb_priv->lock);
		next_fb = fb_priv->port[TYPE_EGRESS];
		if (next_fb == IDP_UNKNOWN)
			fdrop = 1;
	} while (read_seqretry(&fb_priv->lock, seq));
	if (fdrop)
		goto drop;

	hdr = (struct udphdr *) skb_push(skb, sizeof(*hdr));
	if (!hdr)
		goto drop;

	hdr->source = htons(fb_priv->own_port);
	hdr->dest = htons(fb_priv->rem_port);
	hdr->len = htons(skb->len);
	hdr->check = 0;

	write_next_idp_to_skb(skb, fb->idp, next_fb);
	return PPE_SUCCESS;
drop:
	kfree_skb(skb);
	return PPE_DROPPED;
}
开发者ID:pharmafirma,项目名称:reconos,代码行数:34,代码来源:fb_udp.c


示例10: fb_huf_netrx

static int fb_huf_netrx(const struct fblock * const fb,
			  struct sk_buff * const skb,
			  enum path_type * const dir)
{
	unsigned int seq;
//	unsigned int padding;
	struct fb_huf_priv *fb_priv;
//	size_t i = 0;
//	unsigned char ciphertext[16];

	fb_priv = rcu_dereference_raw(fb->private_data);
	do {
		seq = read_seqbegin(&fb_priv->lock);
		write_next_idp_to_skb(skb, fb->idp, fb_priv->port[*dir]);
		if (fb_priv->port[*dir] == IDP_UNKNOWN)
			goto drop;
	} while (read_seqretry(&fb_priv->lock, seq));

	read_lock(&fb_priv->klock);

	//send it trough compression
	compress(skb);	

	read_unlock(&fb_priv->klock);

	return PPE_SUCCESS;
drop:
	printk(KERN_INFO "[fb_aes] drop packet. Out of key material?\n");
	kfree_skb(skb);
	return PPE_DROPPED;
}
开发者ID:pharmafirma,项目名称:reconos,代码行数:31,代码来源:fb_huf.c


示例11: _schedule_next_int

int _schedule_next_int(unsigned long jiffie_f,long arch_cycle_in)
{
	long arch_cycle_offset; 
	unsigned long seq;
	/* 
	 * First figure where we are in time. 
	 * A note on locking.  We are under the timerlist_lock here.  This
	 * means that interrupts are off already, so don't use irq versions.
	 */
	if (unlikely(!hrtimer_use)){
		return 0;
	}
	do {
		seq = read_seqbegin(&xtime_lock);
		arch_cycle_offset = arch_cycle_in - get_arch_cycles(jiffie_f);
	} while (read_seqretry(&xtime_lock, seq));
	/*
	 * If time is already passed, just return saying so.
	 */
	if (arch_cycle_offset <= 0)
		return 1;

	__last_was_long = arch_cycles_per_jiffy == arch_cycle_in;
	reload_timer_chip(arch_cycle_offset);
	return 0;
}
开发者ID:JacksonZhangkun,项目名称:linux-2.6,代码行数:26,代码来源:time.c


示例12: seq_lock_read

static ssize_t seq_lock_read(struct file* filp, char __user *buf, size_t count, loff_t *ppos)
{
	unsigned seq;

	do{
		seq=read_seqbegin(&seq_lock);
		mdelay(10000);
	}while(read_seqretry(&seq_lock, seq));

	return 0;
}
开发者ID:bysun2013,项目名称:Android-Driver,代码行数:11,代码来源:seq_lock.c


示例13: get_jiffies_64

u64 get_jiffies_64(void)
{
	unsigned long seq;
	u64 ret;

	do {
		seq = read_seqbegin(&xtime_lock);
		ret = jiffies_64;
	} while (read_seqretry(&xtime_lock, seq));
	return ret;
}
开发者ID:LittleForker,项目名称:linux-2.6,代码行数:11,代码来源:jiffies.c


示例14: _schedule_jiffies_int

int _schedule_jiffies_int(unsigned long jiffie_f)
{
	long past;
	unsigned long seq;
	if (unlikely(!hrtimer_use)) return 0;
	do {
		seq = read_seqbegin(&xtime_lock);
		past = get_arch_cycles(jiffie_f);
	} while (read_seqretry(&xtime_lock, seq));

	return (past >= arch_cycles_per_jiffy); 
}
开发者ID:JacksonZhangkun,项目名称:linux-2.6,代码行数:12,代码来源:time.c


示例15: sync_seqlock_read

static void sync_seqlock_read(void)
{
    unsigned int data;
    unsigned int seq;

    do {
        seq = read_seqbegin(&sync.seqlock);

        data = sync.seqlock_data;
    } while (read_seqretry(&sync.seqlock, seq));

    printk("seqlock data: %u\n", data);
}
开发者ID:niamster,项目名称:misc,代码行数:13,代码来源:mod_main.c


示例16: current_kernel_time

inline struct timespec current_kernel_time(void)
{
        struct timespec now;
        unsigned long seq;

	do {
		seq = read_seqbegin(&xtime_lock);
		
		now = xtime;
	} while (read_seqretry(&xtime_lock, seq));

	return now; 
}
开发者ID:FatSunHYS,项目名称:OSCourseDesign,代码行数:13,代码来源:time.c


示例17: myinit

int myinit(void)
{
printk("\n Module Inserted\n");
while (read_seqretry(&lock,seq)%2 == 0)
{

	seq=read_seqbegin(&lock);	
	printk("\n Iam in Read Mode ");
	printk("\n Global Value =%d lock.seq=%d\n",global,lock.sequence);
	break;
} 
  
      return 0;

}
开发者ID:coder03,项目名称:ldd,代码行数:15,代码来源:seq_reader2.c


示例18: ktime_get_ts

/**
 * ktime_get_ts - get the monotonic clock in timespec format
 * @ts:		pointer to timespec variable
 *
 * The function calculates the monotonic clock from the realtime
 * clock and the wall_to_monotonic offset and stores the result
 * in normalized timespec format in the variable pointed to by @ts.
 */
void ktime_get_ts(struct timespec *ts)
{
	struct timespec tomono;
	unsigned long seq;

	do {
		seq = read_seqbegin(&xtime_lock);
		getnstimeofday(ts);
		tomono = wall_to_monotonic;

	} while (read_seqretry(&xtime_lock, seq));

	set_normalized_timespec(ts, ts->tv_sec + tomono.tv_sec,
				ts->tv_nsec + tomono.tv_nsec);
}
开发者ID:AppEngine,项目名称:linux-2.6,代码行数:23,代码来源:hrtimer.c


示例19: __vsyscall

static int  __vsyscall(0) asmlinkage vgettimeofday(struct timeval *tv, struct timezone *tz)
{
	unsigned long seq;
	do {
		seq = read_seqbegin(&__vsyscall_gtod_lock);

		if (tv)
			do_vgettimeofday(tv);
		if (tz)
			do_get_tz(tz);

	} while (read_seqretry(&__vsyscall_gtod_lock, seq));

	return 0;
}
开发者ID:mrtos,项目名称:Logitech-Revue,代码行数:15,代码来源:vsyscall-gtod.c


示例20: init_module

int init_module(void)
{
    unsigned long seq;

    write_seqlock(&slock);
    printk("write_seqlock\n");
    write_sequnlock(&slock);
    printk("write_sequnlock\n");

    seq = read_seqbegin(&slock);
    printk("read_seqbegin\n");
    if (read_seqretry(&slock, seq))
        printk("wrong\n");

    return 0;
}
开发者ID:yaojingguo,项目名称:c-code,代码行数:16,代码来源:seqlock_usage.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ read_settings函数代码示例发布时间:2022-05-30
下一篇:
C++ read_seqbegin函数代码示例发布时间: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