Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
fd3aa03e
Commit
fd3aa03e
authored
Dec 20, 2009
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vlm: use a static mutex instead of a mutex variable (and fix a path with a missing unlock).
parent
4b3df746
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
15 deletions
+12
-15
src/input/vlm.c
src/input/vlm.c
+12
-15
No files found.
src/input/vlm.c
View file @
fd3aa03e
...
@@ -112,25 +112,22 @@ static int InputEvent( vlc_object_t *p_this, char const *psz_cmd,
...
@@ -112,25 +112,22 @@ static int InputEvent( vlc_object_t *p_this, char const *psz_cmd,
/*****************************************************************************
/*****************************************************************************
* vlm_New:
* vlm_New:
*****************************************************************************/
*****************************************************************************/
static
vlc_mutex_t
vlm_mutex
=
VLC_STATIC_MUTEX
;
vlm_t
*
__vlm_New
(
vlc_object_t
*
p_this
)
vlm_t
*
__vlm_New
(
vlc_object_t
*
p_this
)
{
{
vlc_value_t
lockval
;
vlm_t
*
p_vlm
=
NULL
,
**
pp_vlm
=
&
(
libvlc_priv
(
p_this
->
p_libvlc
)
->
p_vlm
);
vlm_t
*
p_vlm
=
NULL
,
**
pp_vlm
=
&
(
libvlc_priv
(
p_this
->
p_libvlc
)
->
p_vlm
);
char
*
psz_vlmconf
;
char
*
psz_vlmconf
;
static
const
char
vlm_object_name
[]
=
"vlm daemon"
;
static
const
char
vlm_object_name
[]
=
"vlm daemon"
;
/* Avoid multiple creation */
/* Avoid multiple creation */
if
(
var_Create
(
p_this
->
p_libvlc
,
"vlm_mutex"
,
VLC_VAR_MUTEX
)
||
vlc_mutex_lock
(
&
vlm_mutex
);
var_Get
(
p_this
->
p_libvlc
,
"vlm_mutex"
,
&
lockval
)
)
return
NULL
;
vlc_mutex_lock
(
lockval
.
p_address
);
p_vlm
=
*
pp_vlm
;
p_vlm
=
*
pp_vlm
;
if
(
p_vlm
)
if
(
p_vlm
)
{
/* VLM already exists */
{
/* VLM already exists */
vlc_object_hold
(
p_vlm
);
vlc_object_hold
(
p_vlm
);
vlc_mutex_unlock
(
lockval
.
p_address
);
vlc_mutex_unlock
(
&
vlm_mutex
);
return
p_vlm
;
return
p_vlm
;
}
}
...
@@ -140,7 +137,7 @@ vlm_t *__vlm_New ( vlc_object_t *p_this )
...
@@ -140,7 +137,7 @@ vlm_t *__vlm_New ( vlc_object_t *p_this )
vlm_object_name
);
vlm_object_name
);
if
(
!
p_vlm
)
if
(
!
p_vlm
)
{
{
vlc_mutex_unlock
(
lockval
.
p_address
);
vlc_mutex_unlock
(
&
vlm_mutex
);
return
NULL
;
return
NULL
;
}
}
...
@@ -157,6 +154,7 @@ vlm_t *__vlm_New ( vlc_object_t *p_this )
...
@@ -157,6 +154,7 @@ vlm_t *__vlm_New ( vlc_object_t *p_this )
{
{
vlc_mutex_destroy
(
&
p_vlm
->
lock
);
vlc_mutex_destroy
(
&
p_vlm
->
lock
);
vlc_object_release
(
p_vlm
);
vlc_object_release
(
p_vlm
);
vlc_mutex_unlock
(
&
vlm_mutex
);
return
NULL
;
return
NULL
;
}
}
...
@@ -183,7 +181,7 @@ vlm_t *__vlm_New ( vlc_object_t *p_this )
...
@@ -183,7 +181,7 @@ vlm_t *__vlm_New ( vlc_object_t *p_this )
free
(
psz_vlmconf
);
free
(
psz_vlmconf
);
vlc_object_set_destructor
(
p_vlm
,
(
vlc_destructor_t
)
vlm_Destructor
);
vlc_object_set_destructor
(
p_vlm
,
(
vlc_destructor_t
)
vlm_Destructor
);
vlc_mutex_unlock
(
lockval
.
p_address
);
vlc_mutex_unlock
(
&
vlm_mutex
);
return
p_vlm
;
return
p_vlm
;
}
}
...
@@ -193,15 +191,12 @@ vlm_t *__vlm_New ( vlc_object_t *p_this )
...
@@ -193,15 +191,12 @@ vlm_t *__vlm_New ( vlc_object_t *p_this )
*****************************************************************************/
*****************************************************************************/
void
vlm_Delete
(
vlm_t
*
p_vlm
)
void
vlm_Delete
(
vlm_t
*
p_vlm
)
{
{
vlc_value_t
lockval
;
/* vlm_Delete() is serialized against itself, and against vlm_New().
/* vlm_Delete() is serialized against itself, and against vlm_New().
* This way, vlm_Destructor () (called from vlc_objet_release() above)
* This way, vlm_Destructor () (called from vlc_objet_release() above)
* is serialized against setting libvlc_priv->p_vlm from vlm_New(). */
* is serialized against setting libvlc_priv->p_vlm from vlm_New(). */
var_Get
(
p_vlm
->
p_libvlc
,
"vlm_mutex"
,
&
lockval
);
vlc_mutex_lock
(
&
vlm_mutex
);
vlc_mutex_lock
(
lockval
.
p_address
);
vlc_object_release
(
p_vlm
);
vlc_object_release
(
p_vlm
);
vlc_mutex_unlock
(
lockval
.
p_address
);
vlc_mutex_unlock
(
&
vlm_mutex
);
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -732,8 +727,10 @@ static int vlm_ControlMediaDel( vlm_t *p_vlm, int64_t id )
...
@@ -732,8 +727,10 @@ static int vlm_ControlMediaDel( vlm_t *p_vlm, int64_t id )
vlc_gc_decref
(
p_media
->
vod
.
p_item
);
vlc_gc_decref
(
p_media
->
vod
.
p_item
);
TAB_REMOVE
(
p_vlm
->
i_media
,
p_vlm
->
media
,
p_media
);
if
(
p_media
->
vod
.
p_media
)
p_vlm
->
p_vod
->
pf_media_del
(
p_vlm
->
p_vod
,
p_media
->
vod
.
p_media
);
TAB_REMOVE
(
p_vlm
->
i_media
,
p_vlm
->
media
,
p_media
);
free
(
p_media
);
free
(
p_media
);
/* Check if we need to unload the VOD server */
/* Check if we need to unload the VOD server */
...
...
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