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


C++ LIST_FOREACH函数代码示例

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


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


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