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

C++ LIST_FOREACH函数代码示例

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

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



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

示例1: mpegts_mux_bouquet_rescan

void
mpegts_mux_bouquet_rescan ( const char *src, const char *extra )
{
#if ENABLE_MPEGTS_DVB
  mpegts_network_t *mn;
  mpegts_mux_t *mm;
  ssize_t l;
  const idclass_t *ic;
  uint32_t freq;
  int satpos;
#endif

  if (!src)
    return;
#if ENABLE_MPEGTS_DVB
  if ((l = startswith(src, "dvb-bouquet://dvbs,")) > 0) {
    uint32_t tsid, nbid;
    src += l;
    if ((satpos = dvb_sat_position_from_str(src)) == INT_MAX)
      return;
    while (*src && *src != ',')
      src++;
    if (sscanf(src, ",%x,%x", &tsid, &nbid) != 2)
      return;
    LIST_FOREACH(mn, &mpegts_network_all, mn_global_link)
      LIST_FOREACH(mm, &mn->mn_muxes, mm_network_link)
        if (idnode_is_instance(&mm->mm_id, &dvb_mux_dvbs_class) &&
            mm->mm_tsid == tsid &&
            ((dvb_mux_t *)mm)->lm_tuning.u.dmc_fe_qpsk.orbital_pos == satpos)
          mpegts_mux_scan_state_set(mm, MM_SCAN_STATE_PEND);
    return;
  }
开发者ID:CSchlipp,项目名称:tvheadend,代码行数:32,代码来源:mpegts_network_scan.c


示例2: num_stableptrs

int num_stableptrs(void) {
        int count = 0;
        struct StablePtr *sp;
        LIST_FOREACH(sp, &root_StablePtrs, link)
            count++;
        return count;
}
开发者ID:ajnsit,项目名称:ajhc,代码行数:7,代码来源:stableptr_test.c


示例3: ufs_extattr_vnode_inactive

/*
 * Called by UFS when an inode is no longer active and should have its
 * attributes stripped.
 */
void
ufs_extattr_vnode_inactive(struct vnode *vp, struct thread *td)
{
	struct ufs_extattr_list_entry *uele;
	struct mount *mp = vp->v_mount;
	struct ufsmount *ump = VFSTOUFS(mp);

	/*
	 * In that case, we cannot lock. We should not have any active vnodes
	 * on the fs if this is not yet initialized but is going to be, so
	 * this can go unlocked.
	 */
	if (!(ump->um_extattr.uepm_flags & UFS_EXTATTR_UEPM_INITIALIZED))
		return;

	ufs_extattr_uepm_lock(ump);

	if (!(ump->um_extattr.uepm_flags & UFS_EXTATTR_UEPM_STARTED)) {
		ufs_extattr_uepm_unlock(ump);
		return;
	}

	LIST_FOREACH(uele, &ump->um_extattr.uepm_list, uele_entries)
		ufs_extattr_rm(vp, uele->uele_attrnamespace,
		    uele->uele_attrname, NULL, td);

	ufs_extattr_uepm_unlock(ump);
}
开发者ID:markjdb,项目名称:freebsd-dev,代码行数:32,代码来源:ufs_extattr.c


示例4: HTSMSG_FOREACH

static int _pyepg_parse_schedule 
  ( epggrab_module_t *mod, htsmsg_t *data, epggrab_stats_t *stats )
{
  int save = 0;
  htsmsg_t *attr, *tags;
  htsmsg_field_t *f;
  epggrab_channel_t *ec;
  const char *str;
  epggrab_channel_link_t *ecl;

  if ( data == NULL ) return 0;

  if ((attr = htsmsg_get_map(data, "attrib")) == NULL) return 0;
  if ((str  = htsmsg_get_str(attr, "channel")) == NULL) return 0;
  if ((ec   = _pyepg_channel_find(str, 0, NULL)) == NULL) return 0;
  if ((tags = htsmsg_get_map(data, "tags")) == NULL) return 0;

  HTSMSG_FOREACH(f, tags) {
    if (strcmp(f->hmf_name, "broadcast") == 0) {
      LIST_FOREACH(ecl, &ec->channels, ecl_epg_link)
        save |= _pyepg_parse_broadcast(mod, htsmsg_get_map_by_field(f),
                                       ecl->ecl_channel, stats);
    }
  }

  return save;
}
开发者ID:CSchlipp,项目名称:tvheadend,代码行数:27,代码来源:pyepg.c


示例5: db_show_rm

static void
db_show_rm(const struct lock_object *lock)
{
	struct rm_priotracker *tr;
	struct rm_queue *queue;
	const struct rmlock *rm;
	struct lock_class *lc;
	struct pcpu *pc;

	rm = (const struct rmlock *)lock;
	db_printf(" writecpus: ");
	ddb_display_cpuset(__DEQUALIFY(const cpuset_t *, &rm->rm_writecpus));
	db_printf("\n");
	db_printf(" per-CPU readers:\n");
	STAILQ_FOREACH(pc, &cpuhead, pc_allcpu)
		for (queue = pc->pc_rm_queue.rmq_next;
		    queue != &pc->pc_rm_queue; queue = queue->rmq_next) {
			tr = (struct rm_priotracker *)queue;
			if (tr->rmp_rmlock == rm)
				print_tracker(tr);
		}
	db_printf(" active readers:\n");
	LIST_FOREACH(tr, &rm->rm_activeReaders, rmp_qentry)
		print_tracker(tr);
	lc = LOCK_CLASS(&rm->rm_wlock_object);
	db_printf("Backing write-lock (%s):\n", lc->lc_name);
	lc->lc_ddb_show(&rm->rm_wlock_object);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:28,代码来源:kern_rmlock.c


示例6: _xmltv_str2time

/**
 * Parse a <programme> tag from xmltv
 */
static int _xmltv_parse_programme
  (epggrab_module_t *mod, htsmsg_t *body, epggrab_stats_t *stats)
{
  int save = 0;
  htsmsg_t *attribs, *tags;
  const char *s, *chid;
  time_t start, stop;
  epggrab_channel_t *ch;
  epggrab_channel_link_t *ecl;

  if(body == NULL) return 0;

  if((attribs = htsmsg_get_map(body,    "attrib"))  == NULL) return 0;
  if((tags    = htsmsg_get_map(body,    "tags"))    == NULL) return 0;
  if((chid    = htsmsg_get_str(attribs, "channel")) == NULL) return 0;
  if((ch      = _xmltv_channel_find(chid, 0, NULL))   == NULL) return 0;
  if (!LIST_FIRST(&ch->channels)) return 0;
  if((s       = htsmsg_get_str(attribs, "start"))   == NULL) return 0;
  start = _xmltv_str2time(s);
  if((s       = htsmsg_get_str(attribs, "stop"))    == NULL) return 0;
  stop  = _xmltv_str2time(s);

  if(stop <= start || stop <= dispatch_clock) return 0;

  LIST_FOREACH(ecl, &ch->channels, link)
    save |= _xmltv_parse_programme_tags(mod, ecl->channel, tags,
                                        start, stop, stats);
  return save;
}
开发者ID:Cjcr,项目名称:tvheadend,代码行数:32,代码来源:xmltv.c


示例7: h_require

static void
h_require(const char *name, u_long start,
	u_long end, int flags, const char *exp)
{
	char buf[4096];
	struct extent_region *rp;
	int n = 0;

	ATF_REQUIRE_STREQ_MSG(ex->ex_name, name,
	    "expected: \"%s\", got: \"%s\"", name, ex->ex_name);
	ATF_REQUIRE_EQ_MSG(ex->ex_start, start,
	    "expected: %#lx, got: %#lx", start, ex->ex_start);
	ATF_REQUIRE_EQ_MSG(ex->ex_end, end,
	    "expected: %#lx, got: %#lx", end, ex->ex_end);
	ATF_REQUIRE_EQ_MSG(ex->ex_flags, flags,
	    "expected: %#x, got: %#x", flags, ex->ex_flags);

	(void)memset(buf, 0, sizeof(buf));
	LIST_FOREACH(rp, &ex->ex_regions, er_link)
		n += snprintf(buf + n, sizeof(buf) - n,
		    "0x%lx - 0x%lx\n", rp->er_start, rp->er_end);

	if (strcmp(buf, exp) == 0)
		return;

	printf("Incorrect extent map\n");
	printf("Expected:\n%s\n", exp);
	printf("Got:\n%s\n", buf);
	atf_tc_fail("incorrect extent map");
}
开发者ID:2asoft,项目名称:freebsd,代码行数:30,代码来源:t_extent.c


示例8: mainloop

static void
mainloop(void)
{
  gtimer_t *gti;
  gti_callback_t *cb;
  struct timespec ts;

  while(tvheadend_running) {
    clock_gettime(CLOCK_REALTIME, &ts);

    /* 1sec stuff */
    if (ts.tv_sec > dispatch_clock) {
      dispatch_clock = ts.tv_sec;

      comet_flush(); /* Flush idle comet mailboxes */
    }

    /* Global timers */
    pthread_mutex_lock(&global_lock);

    // TODO: there is a risk that if timers re-insert themselves to
    //       the top of the list with a 0 offset we could loop indefinitely
    
#if 0
    tvhdebug("gtimer", "now %ld.%09ld", ts.tv_sec, ts.tv_nsec);
    LIST_FOREACH(gti, &gtimers, gti_link)
      tvhdebug("gtimer", "  gti %p expire %ld.%08ld",
               gti, gti->gti_expire.tv_sec, gti->gti_expire.tv_nsec);
#endif

    while((gti = LIST_FIRST(&gtimers)) != NULL) {
      
      if ((gti->gti_expire.tv_sec > ts.tv_sec) ||
          ((gti->gti_expire.tv_sec == ts.tv_sec) &&
           (gti->gti_expire.tv_nsec > ts.tv_nsec))) {
        ts = gti->gti_expire;
        break;
      }

      cb = gti->gti_callback;
      //tvhdebug("gtimer", "%p callback", gti);

      LIST_REMOVE(gti, gti_link);
      gti->gti_callback = NULL;

      cb(gti->gti_opaque);
    }

    /* Bound wait */
    if ((LIST_FIRST(&gtimers) == NULL) || (ts.tv_sec > (dispatch_clock + 1))) {
      ts.tv_sec  = dispatch_clock + 1;
      ts.tv_nsec = 0;
    }

    /* Wait */
    //tvhdebug("gtimer", "wait till %ld.%09ld", ts.tv_sec, ts.tv_nsec);
    pthread_cond_timedwait(&gtimer_cond, &global_lock, &ts);
    pthread_mutex_unlock(&global_lock);
  }
}
开发者ID:Jalle19,项目名称:tvheadend,代码行数:60,代码来源:main.c


示例9: media_global_hold

void
media_global_hold(int on, int flag)
{
  int i;
  int count;
  media_pipe_t *mp;

  hts_mutex_lock(&media_mutex);
  count = num_media_pipelines;
  media_pipe_t **mpv = alloca(count * sizeof(media_pipe_t *));

  i = 0;
  LIST_FOREACH(mp, &media_pipelines, mp_global_link)
    mpv[i++] = mp_retain(mp);

  hts_mutex_unlock(&media_mutex);

  for(i = 0; i < count; i++) {
    mp = mpv[i];
    
    if(!(mp->mp_flags & MP_VIDEO))
      continue;

    if(on)
      mp_hold(mp, flag, NULL);
    else
      mp_unhold(mp, flag);

    mp_release(mp);
  }
}
开发者ID:RuralHunter,项目名称:showtime,代码行数:31,代码来源:media.c


示例10: vfs_mountroot_wait

static void
vfs_mountroot_wait(void)
{
	struct root_hold_token *h;
	struct timeval lastfail;
	int curfail;

	curfail = 0;
	while (1) {
		DROP_GIANT();
		g_waitidle();
		PICKUP_GIANT();
		mtx_lock(&mountlist_mtx);
		if (LIST_EMPTY(&root_holds)) {
			mtx_unlock(&mountlist_mtx);
			break;
		}
		if (ppsratecheck(&lastfail, &curfail, 1)) {
			printf("Root mount waiting for:");
			LIST_FOREACH(h, &root_holds, list)
				printf(" %s", h->who);
			printf("\n");
		}
		msleep(&root_holds, &mountlist_mtx, PZERO | PDROP, "roothold",
		    hz);
	}
}
开发者ID:ChristosKa,项目名称:freebsd,代码行数:27,代码来源:vfs_mountroot.c


示例11: ptasync

static void
ptasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg)
{
	struct cam_periph *periph;

	periph = (struct cam_periph *)callback_arg;
	switch (code) {
	case AC_FOUND_DEVICE:
	{
		struct ccb_getdev *cgd;
		cam_status status;
 
		cgd = (struct ccb_getdev *)arg;
		if (cgd == NULL)
			break;

		if (cgd->protocol != PROTO_SCSI)
			break;

		if (SID_TYPE(&cgd->inq_data) != T_PROCESSOR)
			break;

		/*
		 * Allocate a peripheral instance for
		 * this device and start the probe
		 * process.
		 */
		status = cam_periph_alloc(ptctor, ptoninvalidate, ptdtor,
					  ptstart, "pt", CAM_PERIPH_BIO,
					  cgd->ccb_h.path, ptasync,
					  AC_FOUND_DEVICE, cgd);

		if (status != CAM_REQ_CMP
		 && status != CAM_REQ_INPROG)
			printf("ptasync: Unable to attach to new device "
				"due to status 0x%x\n", status);
		break;
	}
	case AC_SENT_BDR:
	case AC_BUS_RESET:
	{
		struct pt_softc *softc;
		struct ccb_hdr *ccbh;

		softc = (struct pt_softc *)periph->softc;
		/*
		 * Don't fail on the expected unit attention
		 * that will occur.
		 */
		softc->flags |= PT_FLAG_RETRY_UA;
		LIST_FOREACH(ccbh, &softc->pending_ccbs, periph_links.le)
			ccbh->ccb_state |= PT_CCB_RETRY_UA;
	}
	/* FALLTHROUGH */
	default:
		cam_periph_async(periph, code, path, arg);
		break;
	}
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:59,代码来源:scsi_pt.c


示例12: console_process_exits

void console_process_exits()
{
	bedrock_node *node;

	LIST_FOREACH(&exiting_client_list, node)
		console_free(node->data);
	bedrock_list_clear(&exiting_client_list);
}
开发者ID:Adam-,项目名称:bedrock,代码行数:8,代码来源:console.c


示例13: ssl_wrap_fini

static void ssl_wrap_fini(void)
{
   struct listen_entry *le;

   /* remove every redirect rule */   
   LIST_FOREACH(le, &listen_ports, next)
      sslw_remove_redirect(le->sslw_port, le->redir_port);
}
开发者ID:ASSmodeus,项目名称:dsploit,代码行数:8,代码来源:ec_sslwrap.c


示例14: LIST_FOREACH

static void
api_dvr_entry_grid
  ( access_t *perm, idnode_set_t *ins, api_idnode_grid_conf_t *conf, htsmsg_t *args )
{
  dvr_entry_t *de;

  LIST_FOREACH(de, &dvrentries, de_global_link)
    idnode_set_add(ins, (idnode_t*)de, &conf->filter, perm->aa_lang);
}
开发者ID:bjoern-r,项目名称:tvheadend,代码行数:9,代码来源:api_dvr.c


示例15: mainloop

static void
mainloop(void)
{
  gtimer_t *gti;
  gti_callback_t *cb;
  time_t now;
  struct timespec ts;
  const char *id;

  while (tvheadend_is_running()) {
    now = gdispatch_clock_update();
    ts.tv_sec  = now + 3600;
    ts.tv_nsec = 0;

    /* Global timers */
    pthread_mutex_lock(&global_lock);

    // TODO: there is a risk that if timers re-insert themselves to
    //       the top of the list with a 0 offset we could loop indefinitely

#if 0
    tvhdebug(LS_GTIMER, "now %"PRItime_t, ts.tv_sec);
    LIST_FOREACH(gti, &gtimers, gti_link)
      tvhdebug(LS_GTIMER, "  gti %p expire %"PRItimet, gti, gti->gti_expire.tv_sec);
#endif

    while((gti = LIST_FIRST(&gtimers)) != NULL) {

      if (gti->gti_expire > now) {
        ts.tv_sec = gti->gti_expire;
        break;
      }

#if ENABLE_GTIMER_CHECK
      id = gti->gti_id;
#else
      id = NULL;
#endif
      tprofile_start(&gtimer_profile, id);

      cb = gti->gti_callback;

      LIST_REMOVE(gti, gti_link);
      gti->gti_callback = NULL;

      cb(gti->gti_opaque);

      tprofile_finish(&gtimer_profile);
    }

    /* Wait */
    pthread_cond_timedwait(&gtimer_cond, &global_lock, &ts);
    pthread_mutex_unlock(&global_lock);
  }
}
开发者ID:Glenn-1990,项目名称:tvheadend,代码行数:55,代码来源:main.c


示例16: got_ca_section

/**
 * Code for dealing with a complete section
 */
static void
got_ca_section(const uint8_t *data, size_t len, void *opaque)
{
  th_descrambler_t *td;
  elementary_stream_t *st = opaque;
  assert(st->es_service->s_source_type == S_MPEG_TS);
  mpegts_service_t *t = (mpegts_service_t*)st->es_service;

  LIST_FOREACH(td, &t->s_descramblers, td_service_link)
    td->td_table(td, (service_t*)t, st, data, len);
}
开发者ID:KawaDict,项目名称:tvheadend,代码行数:14,代码来源:tsdemux.c


示例17: ed_pccard_kick_phy

static int
ed_pccard_kick_phy(struct ed_softc *sc)
{
	struct mii_softc *miisc;
	struct mii_data *mii;

	mii = device_get_softc(sc->miibus);
	LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
		PHY_RESET(miisc);
	return (mii_mediachg(mii));
}
开发者ID:fengsi,项目名称:freebsd,代码行数:11,代码来源:if_ed_pccard.c


示例18: _thread_dump_info

/*
 * compat debug stuff
 */
void
_thread_dump_info(void)
{
	pthread_t thread;

	_spinlock(&_thread_lock);
	LIST_FOREACH(thread, &_thread_list, threads)
		printf("thread %d flags %d name %s\n",
		    thread->tid, thread->flags, thread->name);
	_spinunlock(&_thread_lock);
}
开发者ID:mikekmv,项目名称:aeriebsd-src,代码行数:14,代码来源:rthread.c


示例19: IoMessage_mark

void IoMessage_mark(IoMessage *self)
{
	IoObject_shouldMarkIfNonNull(DATA(self)->name);
	IoObject_shouldMarkIfNonNull(DATA(self)->cachedResult);

	if (DATA(self)->args)
	{
		LIST_FOREACH(DATA(self)->args, i, v, IoObject_shouldMark(v));
	}

	IoObject_shouldMarkIfNonNull((IoObject *)DATA(self)->next);
	IoObject_shouldMarkIfNonNull((IoObject *)DATA(self)->label);
}
开发者ID:mikedouglas,项目名称:io,代码行数:13,代码来源:IoMessage.c


示例20: host_destroy

static void	host_destroy(host_t* self)
{
  /* Cleanup
   */
  struct output_chunk* chunk = NULL;
  LIST_FOREACH(chunk, &self->output_fifo, chunks_list)
    free(chunk);
  if (self->socket)
    self->socket->destroy(self->socket);
  if (self->addr)
    free(self->addr);
  free(self);
}
开发者ID:nicolascormier,项目名称:ncormier-academic-projects,代码行数:13,代码来源:host.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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