示例#1
0
static void itv_stream_destructor(itv_object_t *p_this)
{
	itv_stream_t *istream = (itv_stream_t *)p_this;

	DEBUG_CALLSTACK

	if(istream->idemux)
		itv_object_release(istream->idemux);
}
示例#2
0
void __itv_list_release(itv_object_list_t *p_list)
{
	int i_index;

	for(i_index = 0; i_index < p_list->i_count; i_index++) {
		itv_object_release(p_list->pp_object[i_index]);
	}
	kfree(p_list->pp_object);
	kfree(p_list);
}
示例#3
0
void __itv_object_release(itv_object_t *p_this)
{
	bool b_should_destroy;
	unsigned int pre_ref;

	itv_object_internals_t *p_priv = itv_object_internals(p_this);
	itv_object_t *parent = NULL;

	spin_lock(&p_priv->ref_spin);

	pre_ref = p_priv->refcount;
	if(p_priv->refcount > 1) {
		p_priv->refcount--;
//		printk("[%s] refcount %d %d\n", p_this->psz_object_name, pre_ref, p_priv->refcount);
		spin_unlock(&p_priv->ref_spin);
		return;
	}
	spin_unlock(&p_priv->ref_spin);

	itv_lock(p_this->icore);

	spin_lock(&p_priv->ref_spin);
	b_should_destroy = --p_priv->refcount == 0;
//	printk("[%s] refcount %d %d\n", p_this->psz_object_name, pre_ref, p_priv->refcount);
	spin_unlock(&p_priv->ref_spin);

	if(b_should_destroy) {
		parent = p_this->parent;
		if(ITV_OBJECT(p_this->icore) == p_this) {
			itv_object_t *p_leaked = p_priv->next;
			while(p_leaked != p_this) {
				eprintk("leaking object (type:%s, name:%s)\n", 
						p_leaked->psz_object_type, p_leaked->psz_object_name);
				p_leaked = itv_object_internals(p_leaked)->next;
			}
		}

		itv_object_internals(p_priv->next)->prev = p_priv->prev;
		itv_object_internals(p_priv->prev)->next = p_priv->next;

		if(parent)
			itv_object_detach_unlocked(p_this);
	}
	itv_unlock(p_this->icore);

	if(b_should_destroy) {
		itv_object_destroy(p_this);
		if(parent)
			itv_object_release(parent);
	}
}
示例#4
0
void __itv_object_detach(itv_object_t *p_this)
{
	itv_object_t *parent;

	if(!p_this) return;

	itv_lock(p_this->icore);
	parent = p_this->parent;
	if(parent)
		itv_object_detach_unlocked(p_this);
	itv_unlock(p_this->icore);

	if(parent)
		itv_object_release(parent);
}
示例#5
0
void itv_adapter_destroy(itv_adapter_t *p_iadapter)
{
    DEBUG_CALLSTACK

    itv_object_release(p_iadapter);
}