Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
070e3454
Commit
070e3454
authored
May 31, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Keep track of object held by threads
parent
90fd835f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
1 deletion
+46
-1
src/misc/objects.c
src/misc/objects.c
+46
-1
No files found.
src/misc/objects.c
View file @
070e3454
...
...
@@ -2,7 +2,6 @@
* objects.c: vlc_object_t handling
*****************************************************************************
* Copyright (C) 2004-2008 the VideoLAN team
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
...
...
@@ -82,6 +81,15 @@ static void ListChildren ( vlc_list_t *, vlc_object_t *, int );
static
void
vlc_object_destroy
(
vlc_object_t
*
p_this
);
static
void
vlc_object_detach_unlocked
(
vlc_object_t
*
p_this
);
#ifndef NDEBUG
static
vlc_threadvar_t
held_objects
;
typedef
struct
held_list_t
{
struct
held_list_t
*
next
;
vlc_object_t
*
obj
;
}
held_list_t
;
#endif
/*****************************************************************************
* Local structure lock
*****************************************************************************/
...
...
@@ -142,6 +150,10 @@ void *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
p_libvlc_global
->
i_counter
=
0
;
p_priv
->
next
=
p_priv
->
prev
=
p_new
;
vlc_mutex_init
(
&
structure_lock
);
#ifndef NDEBUG
/* TODO: use the destruction callback to track ref leaks */
vlc_threadvar_create
(
&
held_objects
,
NULL
);
#endif
}
else
{
...
...
@@ -371,6 +383,9 @@ static void vlc_object_destroy( vlc_object_t *p_this )
/* We are the global object ... no need to lock. */
vlc_mutex_destroy
(
&
structure_lock
);
#ifndef NDEBUG
vlc_threadvar_delete
(
&
held_objects
);
#endif
}
FREENULL
(
p_this
->
psz_object_name
);
...
...
@@ -778,6 +793,15 @@ void __vlc_object_yield( vlc_object_t *p_this )
/* Increment the counter */
internals
->
i_refcount
++
;
vlc_spin_unlock
(
&
internals
->
ref_spin
);
#ifndef NDEBUG
/* Update the list of referenced objects */
/* Using TLS, so no need to lock */
held_list_t
*
newhead
=
malloc
(
sizeof
(
*
newhead
));
held_list_t
*
oldhead
=
vlc_threadvar_get
(
&
held_objects
);
newhead
->
next
=
oldhead
;
newhead
->
obj
=
p_this
;
vlc_threadvar_set
(
&
held_objects
,
newhead
);
#endif
}
/*****************************************************************************
...
...
@@ -789,6 +813,27 @@ void __vlc_object_release( vlc_object_t *p_this )
vlc_object_internals_t
*
internals
=
vlc_internals
(
p_this
);
bool
b_should_destroy
;
#ifndef NDEBUG
/* Update the list of referenced objects */
/* Using TLS, so no need to lock */
for
(
held_list_t
*
hlcur
=
vlc_threadvar_get
(
&
held_objects
),
*
hlprev
=
NULL
;
hlcur
!=
NULL
;
hlcur
=
hlcur
->
next
)
{
if
(
hlcur
->
obj
==
p_this
)
{
if
(
hlprev
==
NULL
)
vlc_threadvar_set
(
&
held_objects
,
hlcur
->
next
);
else
hlprev
->
next
=
hlcur
->
next
;
free
(
hlcur
);
break
;
}
}
/* TODO: what if releasing without references? */
#endif
vlc_spin_lock
(
&
internals
->
ref_spin
);
assert
(
internals
->
i_refcount
>
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment