Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
51a26d08
Commit
51a26d08
authored
Nov 10, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
media library: remove non-sensical use of spin locks
The code is complete and utter crap either way.
parent
b287bd3d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
16 deletions
+0
-16
include/vlc_media_library.h
include/vlc_media_library.h
+0
-6
modules/media_library/media_pool.c
modules/media_library/media_pool.c
+0
-6
src/misc/media_library.c
src/misc/media_library.c
+0
-4
No files found.
include/vlc_media_library.h
View file @
51a26d08
...
@@ -181,7 +181,6 @@ typedef struct ml_ftree_t ml_ftree_t;
...
@@ -181,7 +181,6 @@ typedef struct ml_ftree_t ml_ftree_t;
typedef
struct
ml_gc_object_t
typedef
struct
ml_gc_object_t
{
{
vlc_spinlock_t
spin
;
bool
pool
;
bool
pool
;
uintptr_t
refs
;
uintptr_t
refs
;
void
(
*
pf_destructor
)
(
struct
ml_gc_object_t
*
);
void
(
*
pf_destructor
)
(
struct
ml_gc_object_t
*
);
...
@@ -514,9 +513,7 @@ static inline void ml_gc_incref( ml_media_t* p_media )
...
@@ -514,9 +513,7 @@ static inline void ml_gc_incref( ml_media_t* p_media )
if
(
p_gc
==
NULL
)
if
(
p_gc
==
NULL
)
return
;
return
;
vlc_spin_lock
(
&
p_gc
->
spin
);
++
p_gc
->
refs
;
++
p_gc
->
refs
;
vlc_spin_unlock
(
&
p_gc
->
spin
);
}
}
/**
/**
...
@@ -532,14 +529,11 @@ static inline void ml_gc_decref( ml_media_t* p_media )
...
@@ -532,14 +529,11 @@ static inline void ml_gc_decref( ml_media_t* p_media )
if
(
p_gc
==
NULL
)
if
(
p_gc
==
NULL
)
return
;
return
;
vlc_spin_lock
(
&
p_gc
->
spin
);
refs
=
--
p_gc
->
refs
;
refs
=
--
p_gc
->
refs
;
pool
=
p_gc
->
pool
;
pool
=
p_gc
->
pool
;
vlc_spin_unlock
(
&
p_gc
->
spin
);
if
(
refs
==
0
&&
!
pool
)
if
(
refs
==
0
&&
!
pool
)
{
{
vlc_spin_destroy
(
&
p_gc
->
spin
);
p_gc
->
pf_destructor
(
p_gc
);
p_gc
->
pf_destructor
(
p_gc
);
}
}
}
}
...
...
modules/media_library/media_pool.c
View file @
51a26d08
...
@@ -66,7 +66,6 @@ int pool_InsertMedia( media_library_t* p_ml, ml_media_t* p_media, bool locked )
...
@@ -66,7 +66,6 @@ int pool_InsertMedia( media_library_t* p_ml, ml_media_t* p_media, bool locked )
ml_LockMedia
(
p_media
);
ml_LockMedia
(
p_media
);
assert
(
p_media
);
assert
(
p_media
);
assert
(
p_media
->
i_id
>
0
);
assert
(
p_media
->
i_id
>
0
);
vlc_spin_lock
(
&
p_media
->
ml_gc_data
.
spin
);
if
(
p_media
->
ml_gc_data
.
pool
)
if
(
p_media
->
ml_gc_data
.
pool
)
{
{
msg_Dbg
(
p_ml
,
"Already in pool! %s %d"
,
p_media
->
psz_uri
,
p_media
->
i_id
);
msg_Dbg
(
p_ml
,
"Already in pool! %s %d"
,
p_media
->
psz_uri
,
p_media
->
i_id
);
...
@@ -74,7 +73,6 @@ int pool_InsertMedia( media_library_t* p_ml, ml_media_t* p_media, bool locked )
...
@@ -74,7 +73,6 @@ int pool_InsertMedia( media_library_t* p_ml, ml_media_t* p_media, bool locked )
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
p_media
->
ml_gc_data
.
pool
=
true
;
p_media
->
ml_gc_data
.
pool
=
true
;
vlc_spin_unlock
(
&
p_media
->
ml_gc_data
.
spin
);
int
i_ret
=
VLC_SUCCESS
;
int
i_ret
=
VLC_SUCCESS
;
vlc_mutex_lock
(
&
p_ml
->
p_sys
->
pool_mutex
);
vlc_mutex_lock
(
&
p_ml
->
p_sys
->
pool_mutex
);
mp_foreachlist
(
p_ml
->
p_sys
->
p_mediapool
[
(
mediapool_hash
(
p_media
->
i_id
))
],
p_item
)
mp_foreachlist
(
p_ml
->
p_sys
->
p_mediapool
[
(
mediapool_hash
(
p_media
->
i_id
))
],
p_item
)
...
@@ -128,18 +126,14 @@ void pool_GC( media_library_t* p_ml )
...
@@ -128,18 +126,14 @@ void pool_GC( media_library_t* p_ml )
{
{
p_media
=
p_item
->
p_media
;
p_media
=
p_item
->
p_media
;
int
refs
;
int
refs
;
vlc_spin_lock
(
&
p_media
->
ml_gc_data
.
spin
);
refs
=
p_media
->
ml_gc_data
.
refs
;
refs
=
p_media
->
ml_gc_data
.
refs
;
vlc_spin_unlock
(
&
p_media
->
ml_gc_data
.
spin
);
if
(
refs
==
1
)
if
(
refs
==
1
)
{
{
if
(
p_prev
==
NULL
)
if
(
p_prev
==
NULL
)
p_ml
->
p_sys
->
p_mediapool
[
i_idx
]
=
p_item
->
p_next
;
p_ml
->
p_sys
->
p_mediapool
[
i_idx
]
=
p_item
->
p_next
;
else
else
p_prev
->
p_next
=
p_item
->
p_next
;
p_prev
->
p_next
=
p_item
->
p_next
;
vlc_spin_lock
(
&
p_media
->
ml_gc_data
.
spin
);
p_media
->
ml_gc_data
.
pool
=
false
;
p_media
->
ml_gc_data
.
pool
=
false
;
vlc_spin_unlock
(
&
p_media
->
ml_gc_data
.
spin
);
ml_gc_decref
(
p_item
->
p_media
);
//This should destroy the object
ml_gc_decref
(
p_item
->
p_media
);
//This should destroy the object
free
(
p_item
);
free
(
p_item
);
}
}
...
...
src/misc/media_library.c
View file @
51a26d08
...
@@ -57,10 +57,6 @@ static void *ml_gc_init (ml_gc_object_t *p_gc, void (*pf_destruct) (ml_gc_object
...
@@ -57,10 +57,6 @@ static void *ml_gc_init (ml_gc_object_t *p_gc, void (*pf_destruct) (ml_gc_object
p_gc
->
pool
=
false
;
p_gc
->
pool
=
false
;
p_gc
->
refs
=
1
;
p_gc
->
refs
=
1
;
/* Nobody else can possibly lock the spin - it's there as a barrier */
vlc_spin_init
(
&
p_gc
->
spin
);
vlc_spin_lock
(
&
p_gc
->
spin
);
vlc_spin_unlock
(
&
p_gc
->
spin
);
return
p_gc
;
return
p_gc
;
}
}
...
...
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