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

C++ ref_hold函数代码示例

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

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



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

示例1: cmyth_chain_create

cmyth_chain_t
cmyth_chain_create(cmyth_recorder_t rec, char *chain_id)
{
	cmyth_chain_t chain;
	struct event_loop_args *args;

	args = ref_alloc(sizeof(*args));

	chain = ref_alloc(sizeof(*chain));

	chain->chain_id = ref_strdup(chain_id);
	chain->chain_count = 0;
	chain->chain_current = -1;
	chain->chain_list = NULL;
	chain->chain_callback = NULL;
	chain->chain_event = NULL;
	chain->chain_thread = 0;
	chain->chain_conn = ref_hold(rec->rec_conn);

	pthread_mutex_init(&chain->chain_mutex, NULL);
	pthread_cond_init(&chain->chain_cond, NULL);

	ref_set_destroy(chain, (ref_destroy_t)cmyth_chain_destroy);

	args->rec = ref_hold(rec);
	args->chain = ref_hold(chain);

	chain->chain_thread_args = (void*)args;

	pthread_create(&chain->chain_thread, NULL,
		       cmyth_chain_event_loop, (void*)args);

	return chain;
}
开发者ID:Ferdiand,项目名称:cmyth,代码行数:34,代码来源:chain.c


示例2: o_files

static int o_files(int f, struct path_info *info, struct fuse_file_info *fi)
{
	int i;
	cmyth_conn_t control;
	cmyth_proglist_t list;
	int count;
	int ret = -ENOENT;

	pthread_mutex_lock(&mutex);

	if ((i=lookup_server(info->host)) < 0) {
		pthread_mutex_unlock(&mutex);
		return -ENOENT;
	}

	control = ref_hold(conn[i].control);

	if (conn[i].list == NULL) {
		list = cmyth_proglist_get_all_recorded(control);
		conn[i].list = list;
		parse_progs(conn+i);
	} else {
		list = conn[i].list;
	}

	list = ref_hold(list);

	pthread_mutex_unlock(&mutex);

	count = cmyth_proglist_get_count(list);

	for (i=0; i<count; i++) {
		cmyth_proginfo_t prog;
		char *pn;

		prog = cmyth_proglist_get_item(list, i);
		pn = cmyth_proginfo_pathname(prog);

		if (strcmp(pn+1, info->file) == 0) {
			if (do_open(prog, fi, f) < 0) {
				ref_release(pn);
				ref_release(prog);
				goto out;
			}
			ref_release(pn);
			ref_release(prog);
			ret = 0;
			goto out;
		}

		ref_release(pn);
		ref_release(prog);
	}

out:
	ref_release(control);
	ref_release(list);

	return ret;
}
开发者ID:cmyth,项目名称:cmyth,代码行数:60,代码来源:mythfuse.c


示例3: rd_files

static int
rd_files(struct path_info *info, void *buf, fuse_fill_dir_t filler,
	 off_t offset, struct fuse_file_info *fi)
{
	int i;
	cmyth_conn_t control;
	cmyth_proglist_t list;
	int count;

	pthread_mutex_lock(&mutex);

	if ((i=lookup_server(info->host)) < 0) {
		pthread_mutex_unlock(&mutex);
		return 0;
	}

	control = ref_hold(conn[i].control);

	if (conn[i].list == NULL) {
		list = cmyth_proglist_get_all_recorded(control);
		conn[i].list = list;
	} else {
		list = conn[i].list;
	}

	list = ref_hold(list);

	pthread_mutex_unlock(&mutex);

	count = cmyth_proglist_get_count(list);

	for (i=0; i<count; i++) {
		cmyth_proginfo_t prog;
		long long len;
		char *fn, *pn;
		struct stat st;

		prog = cmyth_proglist_get_item(list, i);
		pn = cmyth_proginfo_pathname(prog);
		len = cmyth_proginfo_length(prog);

		fn = pn+1;

		memset(&st, 0, sizeof(st));
		st.st_mode = S_IFREG | 0444;
		st.st_size = len;

		debug("%s(): file '%s' len %lld\n", __FUNCTION__, fn, len);
		filler(buf, fn, &st, 0);

		ref_release(prog);
		ref_release(pn);
	}

	ref_release(control);
	ref_release(list);

	return 0;
}
开发者ID:tsp,项目名称:cmyth,代码行数:59,代码来源:mythfuse.c


示例4: cmyth_livetv_chain_add_url

/*
 * cmyth_livetv_chain_add_url(cmyth_recorder_t rec, char * url)
 * 
 * Scope: PRIVATE
 *
 * Description
 *
 * Called to add a url to a livetv chain structure. The url is added
 * only if it is not already there.
 *
 * Return Value:
 *
 * Success: 0
 *
 * Faiure: -1
 */
static int
cmyth_livetv_chain_add_url(cmyth_recorder_t rec, char * url)
{
	char ** tmp;
	cmyth_file_t * fp;
	cmyth_proginfo_t * pi;
	int ret = 0;

	if(cmyth_livetv_chain_has_url(rec,url) == -1) {
		if(rec->rec_livetv_chain->chain_current == -1) {
			rec->rec_livetv_chain->chain_ct = 1;
			rec->rec_livetv_chain->chain_current = 0;
			/* Nothing in the chain yet, allocate the space */
			tmp = (char**)ref_alloc(sizeof(char *));
			fp = (cmyth_file_t *)ref_alloc(sizeof(cmyth_file_t));
			pi = (cmyth_proginfo_t *)ref_alloc(sizeof(cmyth_proginfo_t));
		}
		else {
			rec->rec_livetv_chain->chain_ct++;
			tmp = (char**)ref_realloc(rec->rec_livetv_chain->chain_urls,
								sizeof(char *)*rec->rec_livetv_chain->chain_ct);
			fp = (cmyth_file_t *)
					ref_realloc(rec->rec_livetv_chain->chain_files,
								sizeof(cmyth_file_t)*rec->rec_livetv_chain->chain_ct);
			pi = (cmyth_proginfo_t *)
					ref_realloc(rec->rec_livetv_chain->progs,
								sizeof(cmyth_proginfo_t)*rec->rec_livetv_chain->chain_ct);
		}
		if(tmp != NULL && fp != NULL) {
			rec->rec_livetv_chain->chain_urls = ref_hold(tmp);
			rec->rec_livetv_chain->chain_files = ref_hold(fp);
			rec->rec_livetv_chain->progs = ref_hold(pi);
			ref_release(tmp);
			ref_release(fp);
			ref_release(pi);
			rec->rec_livetv_chain->chain_urls[rec->rec_livetv_chain->chain_ct-1]
							= ref_strdup(url);
			rec->rec_livetv_chain->chain_files[rec->rec_livetv_chain->chain_ct-1]
							= ref_hold(NULL);
			rec->rec_livetv_chain->progs[rec->rec_livetv_chain->chain_ct-1]
							= ref_hold(NULL);
		}
		else {
			ret = -1;
			cmyth_dbg(CMYTH_DBG_ERROR,
			 		"%s: memory allocation request failed\n",
			 		__FUNCTION__);
		}

	}
	return ret;
}
开发者ID:Castlecard,项目名称:plex,代码行数:68,代码来源:livetv.c


示例5: cmyth_livetv_chain_switch

/*
 * cmyth_livetv_chain_switch(cmyth_recorder_t rec, int dir)
 * 
 * Scope: PUBLIC
 *
 * Description
 *
 * Switches to the next or previous chain depending on the
 * value of dir. Dir is usually 1 or -1.
 *
 * Return Value:
 *
 * Sucess: 1
 *
 * Failure: 0
 */
int
cmyth_livetv_chain_switch(cmyth_recorder_t rec, int dir)
{
	int ret;

	ret = 0;

	if(dir == LAST) {
		PRINTF("**SSDEBUG:(cmyth_livetv_chain_switch) dir: %d\n", dir);
		dir = rec->rec_livetv_chain->chain_ct
				- rec->rec_livetv_chain->chain_current - 1;
		ret = 1;
	}

	if((dir < 0 && rec->rec_livetv_chain->chain_current + dir >= 0)
		|| (rec->rec_livetv_chain->chain_current <
			  rec->rec_livetv_chain->chain_ct - dir )) {
		ref_release(rec->rec_livetv_file);
		ret = rec->rec_livetv_chain->chain_current += dir;
		PRINTF("**SSDEBUG:(cmyth_livetv_chain_switch): %s:%d\n",
		"dooingSwitcheroo",ret);
		rec->rec_livetv_file = ref_hold(rec->rec_livetv_chain->chain_files[ret]);
		rec->rec_livetv_chain
					->prog_update_callback(rec->rec_livetv_chain->progs[ret]);
		ret = 1;
	}

	return ret;
}
开发者ID:Castlecard,项目名称:plex,代码行数:45,代码来源:livetv.c


示例6: cmyth_mysql_query_create

/**
 * Allocate a dynamic query string to have parameters added to it
 * \param db database connection object
 * \param query_string Query string with ? placemarks for all dynamic
 * 			parameters, this is NOT copied and must therefore
 * 			remain valid for the life of the query.
 */
cmyth_mysql_query_t * 
cmyth_mysql_query_create(cmyth_database_t db, const char * query_string)
{
    cmyth_mysql_query_t * out;
    out = ref_alloc(sizeof(*out));
    if(out != NULL)
    {
	ref_set_destroy(out,query_destroy);
	out->source = out->source_pos = query_string;
	out->source_len = strlen(out->source);
	out->buf_size = out->source_len *2;
	out->buf_used = 0;
	out->db = ref_hold(db);
	out->buf = ref_alloc(out->buf_size);
	if(out->buf == NULL)
	{
	    ref_release(out);
	    out = NULL;
	}
	else
	{
	    out->buf[0] = '\0';
	}

    }
    return out;
}
开发者ID:Bladed,项目名称:xbmc,代码行数:34,代码来源:mysql_query.c


示例7: cmyth_chain_set_current

int
cmyth_chain_set_current(cmyth_chain_t chain, cmyth_proginfo_t prog)
{
	unsigned int i;
	int rc = -1;
	void (*callback)(cmyth_proginfo_t prog) = NULL;
	cmyth_proginfo_t cb_prog = NULL;

	if ((chain == NULL) || (prog == NULL)) {
		return -1;
	}

	pthread_mutex_lock(&chain->chain_mutex);

	for (i=0; i<chain->chain_count; i++) {
		if (cmyth_proginfo_compare(prog,
					   chain->chain_list[i]->prog) == 0) {
			chain->chain_current = i;
			callback = chain->chain_callback;
			if (callback) {
				cb_prog = ref_hold(chain->chain_list[i]->prog);
			}
			break;
		}
	}

	pthread_mutex_unlock(&chain->chain_mutex);

	if (callback && cb_prog) {
		callback(cb_prog);
		ref_release(cb_prog);
	}

	return rc;
}
开发者ID:Ferdiand,项目名称:cmyth,代码行数:35,代码来源:chain.c


示例8: cmyth_chain_current_file

cmyth_file_t
cmyth_chain_current_file(cmyth_chain_t chain)
{
	cmyth_file_t file = NULL;

	if (chain == NULL) {
		return NULL;
	}

	pthread_mutex_lock(&chain->chain_mutex);

	if (chain->chain_list) {
		file = chain->chain_list[chain->chain_current]->file;
		if (file == NULL) {
			cmyth_chain_switch_to_locked(chain,
						     chain->chain_current);
			file = chain->chain_list[chain->chain_current]->file;
		}
		ref_hold(file);
	}

	pthread_mutex_unlock(&chain->chain_mutex);

	return file;
}
开发者ID:Ferdiand,项目名称:cmyth,代码行数:25,代码来源:chain.c


示例9: cmyth_livetv_chain_add_prog

/*
 * cmyth_livetv_chain_add_prog(cmyth_recorder_t rec, char * url,
 *                             cmyth_proginfo_t prog)
 * 
 * Scope: PRIVATE
 *
 * Description
 *
 * Called to add program info to a livetv chain structure. The info is added
 * only if the url is already there.
 *
 * Return Value:
 *
 * Success: 0
 *
 * Faiure: -1
 */
static int
cmyth_livetv_chain_add_prog(cmyth_recorder_t rec, char * url,
														cmyth_proginfo_t prog)
{

	int cur;
	int ret = 0;
	cmyth_proginfo_t tmp;

	if(rec->rec_livetv_chain) {
		if(rec->rec_livetv_chain->chain_current != -1) {
			/* Is this file already in the chain? */
			if((cur = cmyth_livetv_chain_has_url(rec, url)) != -1) {
				/* Release the existing handle after holding the new */
				/* this allows them to be the same. */
				tmp = rec->rec_livetv_chain->progs[cur];
				rec->rec_livetv_chain->progs[cur] = ref_hold(prog);
				ref_release(tmp);
			}
		}
		else {
			cmyth_dbg(CMYTH_DBG_ERROR,
			 		"%s: attempted to add prog for %s to an empty chain\n",
			 		__FUNCTION__, url);
			ret = -1;
		}
	}
	else {
		cmyth_dbg(CMYTH_DBG_ERROR,
		 		"%s: attempted to add prog for %s to an non existant chain\n",
		 		__FUNCTION__, url);
		ret = -1;
	}
	return ret;
}
开发者ID:Castlecard,项目名称:plex,代码行数:52,代码来源:livetv.c


示例10: cmyth_recordingrule_playgroup

char *
cmyth_recordingrule_playgroup(cmyth_recordingrule_t rr)
{
	if (!rr) {
		return NULL;
	}
	return ref_hold(rr->playgroup);
}
开发者ID:Alpha13s,项目名称:xbmc-pvr-addons,代码行数:8,代码来源:recordingrule.c


示例11: cmyth_recordingrule_storagegroup

char *
cmyth_recordingrule_storagegroup(cmyth_recordingrule_t rr)
{
	if (!rr) {
		return NULL;
	}
	return ref_hold(rr->storagegroup);
}
开发者ID:Alpha13s,项目名称:xbmc-pvr-addons,代码行数:8,代码来源:recordingrule.c


示例12: cmyth_channel_icon

/*
 * cmyth_channel_icon()
 *
 *
 * Scope: PUBLIC
 *
 * Description
 *
 * Retrieves the 'icon' field of a channel structure.
 *
 * The returned string is a pointer to the string within the channel
 * structure, so it should not be modified by the caller.  The
 * return value is a 'char *' for this reason.
 * Before forgetting the reference to this string the caller
 * must call ref_release().
 *
 * Return Value:
 *
 * Success: A pointer to a 'char *' pointing to the field.
 *
 * Failure: NULL
 */
char *
cmyth_channel_icon(cmyth_channel_t channel)
{
	if (!channel) {
		return NULL;
	}
	return ref_hold(channel->icon);
}
开发者ID:Alpha13s,项目名称:xbmc-pvr-addons,代码行数:30,代码来源:channel.c


示例13: cmyth_recordingrule_category

char *
cmyth_recordingrule_category(cmyth_recordingrule_t rr)
{
	if (!rr) {
		return NULL;
	}
	return ref_hold(rr->category);
}
开发者ID:Alpha13s,项目名称:xbmc-pvr-addons,代码行数:8,代码来源:recordingrule.c


示例14: cmyth_proginfo_prodyear

/*
 * cmyth_proginfo_prodyear(cmyth_proginfo_t prog)
 *
 *
 * Scope: PUBLIC
 *
 * Description
 *
 * Retrieves the 'proginfo_prodyear' field of a program info
 * structure.
 *
 * The returned string is a pointer to the string within the program
 * info structure, so it should not be modified by the caller.  The
 * return value is a 'char *' for this reason.
 *
 * Return Value:
 *
 * Success: A pointer to a 'char *' pointing to the field.
 *
 * Failure: NULL
 */
char *
cmyth_proginfo_prodyear(cmyth_proginfo_t prog)
{
    if (!prog) {
        return NULL;
    }
    return ref_hold(prog->proginfo_prodyear);
}
开发者ID:sd-eblana,项目名称:bawx,代码行数:29,代码来源:proginfo.c


示例15: cmyth_recordingrule_seriesid

char *
cmyth_recordingrule_seriesid(cmyth_recordingrule_t rr)
{
	if (!rr) {
		return NULL;
	}
	return ref_hold(rr->seriesid);
}
开发者ID:Alpha13s,项目名称:xbmc-pvr-addons,代码行数:8,代码来源:recordingrule.c


示例16: cmyth_channel_name

/*
 * cmyth_channel_name()
 *
 *
 * Scope: PUBLIC
 *
 * Description
 *
 * Retrieves the 'name' field of a channel structure.
 *
 * The returned string is a pointer to the string within the channel
 * structure, so it should not be modified by the caller.  The
 * return value is a 'char *' for this reason.
 * Before forgetting the reference to this string the caller
 * must call ref_release().
 *
 * Return Value:
 *
 * Success: A pointer to a 'char *' pointing to the field.
 *
 * Failure: NULL
 */
char *
cmyth_channel_name(cmyth_channel_t channel)
{
	if (!channel) {
		return NULL;
	}
	return ref_hold(channel->name);
}
开发者ID:Alpha13s,项目名称:xbmc-pvr-addons,代码行数:30,代码来源:channel.c


示例17: cmyth_proginfo_rec_end

/*
 * cmyth_proginfo_rec_end(cmyth_proginfo_t prog)
 *
 *
 * Scope: PUBLIC
 *
 * Description
 *
 * Retrieves the 'rec_end' timestamp from a program info structure.
 * This tells when a recording started.
 *
 * The returned timestamp is returned held.  It should be released
 * when no longer needed using ref_release().
 *
 * Return Value:
 *
 * Success: A non-NULL cmyth_timestamp_t
 *
 * Failure: NULL
 */
cmyth_timestamp_t
cmyth_proginfo_rec_end(cmyth_proginfo_t prog)
{
	if (!prog) {
		return NULL;
	}
	return ref_hold(prog->proginfo_rec_end_ts);
}
开发者ID:Ferdiand,项目名称:cmyth,代码行数:28,代码来源:proginfo.c


示例18: cmyth_proginfo_start

/*
 * cmyth_proginfo_start(cmyth_proginfo_t prog)
 *
 *
 * Scope: PUBLIC
 *
 * Description
 *
 * Retrieves the 'start' timestamp from a program info structure.
 * This indicates a programmes start time.
 *
 * The returned timestamp is returned held.  It should be released
 * when no longer needed using ref_release().
 *
 * Return Value:
 *
 * Success: A non-NULL cmyth_timestamp_t
 *
 * Failure: NULL
 */
cmyth_timestamp_t
cmyth_proginfo_start(cmyth_proginfo_t prog)
{
	if (!prog) {
		return NULL;
	}
	return ref_hold(prog->proginfo_start_ts);
}
开发者ID:Ferdiand,项目名称:cmyth,代码行数:28,代码来源:proginfo.c


示例19: cmyth_proginfo_pathname

/*
 * cmyth_proginfo_channame(cmyth_proginfo_t prog)
 *
 *
 * Scope: PUBLIC
 *
 * Description
 *
 * Retrieves the 'proginfo_pathname' field of a program info
 * structure.
 *
 * The returned string is a pointer to the string within the program
 * info structure, so it should not be modified by the caller.  The
 * return value is a 'char *' for this reason.
 *
 * Return Value:
 *
 * Success: A pointer to a 'char *' pointing to the field.
 *
 * Failure: NULL
 */
char *
cmyth_proginfo_pathname(cmyth_proginfo_t prog)
{
	if (!prog) {
		return NULL;
	}
	return ref_hold(prog->proginfo_pathname);
}
开发者ID:Ferdiand,项目名称:cmyth,代码行数:29,代码来源:proginfo.c


示例20: cmyth_recordingrule_profile

char *
cmyth_recordingrule_profile(cmyth_recordingrule_t rr)
{
	if (!rr) {
		return NULL;
	}
	return ref_hold(rr->profile);
}
开发者ID:Alpha13s,项目名称:xbmc-pvr-addons,代码行数:8,代码来源:recordingrule.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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