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
959c5560
Commit
959c5560
authored
Mar 30, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use var_AcquireMutex for the "libvlc" lock
parent
e4e91829
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
34 deletions
+17
-34
src/libvlc-common.c
src/libvlc-common.c
+5
-10
src/modules/modules.c
src/modules/modules.c
+12
-24
No files found.
src/libvlc-common.c
View file @
959c5560
...
...
@@ -151,7 +151,6 @@ libvlc_int_t * libvlc_InternalCreate( void )
{
int
i_ret
;
libvlc_int_t
*
p_libvlc
=
NULL
;
vlc_value_t
lockval
;
char
*
psz_env
=
NULL
;
/* vlc_threads_init *must* be the first internal call! No other call is
...
...
@@ -160,10 +159,8 @@ libvlc_int_t * libvlc_InternalCreate( void )
if
(
i_ret
<
0
)
return
NULL
;
/* Now that the thread system is initialized, we don't have much, but
* at least we have var_Create */
var_Create
(
p_libvlc_global
,
"libvlc"
,
VLC_VAR_MUTEX
);
var_Get
(
p_libvlc_global
,
"libvlc"
,
&
lockval
);
vlc_mutex_lock
(
lockval
.
p_address
);
* at least we have variables */
vlc_mutex_t
*
lock
=
var_AcquireMutex
(
"libvlc"
);
i_instances
++
;
...
...
@@ -176,7 +173,7 @@ libvlc_int_t * libvlc_InternalCreate( void )
p_libvlc_global
->
b_ready
=
VLC_TRUE
;
}
vlc_mutex_unlock
(
lock
val
.
p_address
);
vlc_mutex_unlock
(
lock
);
/* Allocate a libvlc instance object */
p_libvlc
=
vlc_object_create
(
p_libvlc_global
,
VLC_OBJECT_LIBVLC
);
...
...
@@ -1044,9 +1041,7 @@ int libvlc_InternalDestroy( libvlc_int_t *p_libvlc, vlc_bool_t b_release )
p_libvlc
->
p_hotkeys
);
FREENULL
(
p_libvlc
->
p_hotkeys
);
var_Create
(
p_libvlc_global
,
"libvlc"
,
VLC_VAR_MUTEX
);
var_Get
(
p_libvlc_global
,
"libvlc"
,
&
lockval
);
vlc_mutex_lock
(
lockval
.
p_address
);
vlc_mutex_t
*
lock
=
var_AcquireMutex
(
"libvlc"
);
i_instances
--
;
if
(
i_instances
==
0
)
...
...
@@ -1054,7 +1049,7 @@ int libvlc_InternalDestroy( libvlc_int_t *p_libvlc, vlc_bool_t b_release )
/* System specific cleaning code */
system_End
(
p_libvlc
);
}
vlc_mutex_unlock
(
lock
val
.
p_address
);
vlc_mutex_unlock
(
lock
);
msg_Flush
(
p_libvlc
);
msg_Destroy
(
p_libvlc
);
...
...
src/modules/modules.c
View file @
959c5560
...
...
@@ -115,12 +115,9 @@ static void UndupModule ( module_t * );
void
__module_InitBank
(
vlc_object_t
*
p_this
)
{
module_bank_t
*
p_bank
=
NULL
;
vlc_value_t
lockval
;
libvlc_global_data_t
*
p_libvlc_global
=
vlc_global
();
var_Create
(
p_libvlc_global
,
"libvlc"
,
VLC_VAR_MUTEX
);
var_Get
(
p_libvlc_global
,
"libvlc"
,
&
lockval
);
vlc_mutex_lock
(
lockval
.
p_address
);
vlc_mutex_t
*
lock
=
var_AcquireMutex
(
"libvlc"
);
if
(
p_libvlc_global
->
p_module_bank
==
NULL
)
{
...
...
@@ -146,7 +143,7 @@ void __module_InitBank( vlc_object_t *p_this )
else
p_libvlc_global
->
p_module_bank
->
i_usage
++
;
vlc_mutex_unlock
(
lock
val
.
p_address
);
vlc_mutex_unlock
(
lock
);
}
...
...
@@ -161,23 +158,20 @@ void __module_InitBank( vlc_object_t *p_this )
void
__module_EndBank
(
vlc_object_t
*
p_this
)
{
module_t
*
p_next
=
NULL
;
vlc_value_t
lockval
;
libvlc_global_data_t
*
p_libvlc_global
=
vlc_global
();
var_Create
(
p_libvlc_global
,
"libvlc"
,
VLC_VAR_MUTEX
);
var_Get
(
p_libvlc_global
,
"libvlc"
,
&
lockval
);
vlc_mutex_lock
(
lockval
.
p_address
);
vlc_mutex_t
*
lock
=
var_AcquireMutex
(
"libvlc"
);
if
(
!
p_libvlc_global
->
p_module_bank
)
{
vlc_mutex_unlock
(
lock
val
.
p_address
);
vlc_mutex_unlock
(
lock
);
return
;
}
if
(
--
p_libvlc_global
->
p_module_bank
->
i_usage
)
{
vlc_mutex_unlock
(
lock
val
.
p_address
);
vlc_mutex_unlock
(
lock
);
return
;
}
vlc_mutex_unlock
(
lock
val
.
p_address
);
vlc_mutex_unlock
(
lock
);
/* Save the configuration */
config_AutoSaveConfigFile
(
p_this
);
...
...
@@ -247,19 +241,16 @@ void __module_EndBank( vlc_object_t *p_this )
*/
void
__module_LoadBuiltins
(
vlc_object_t
*
p_this
)
{
vlc_value_t
lockval
;
libvlc_global_data_t
*
p_libvlc_global
=
vlc_global
();
var_Create
(
p_libvlc_global
,
"libvlc"
,
VLC_VAR_MUTEX
);
var_Get
(
p_libvlc_global
,
"libvlc"
,
&
lockval
);
vlc_mutex_lock
(
lockval
.
p_address
);
vlc_mutex_t
*
lock
=
var_AcquireMutex
(
"libvlc"
);
if
(
p_libvlc_global
->
p_module_bank
->
b_builtins
)
{
vlc_mutex_unlock
(
lock
val
.
p_address
);
vlc_mutex_unlock
(
lock
);
return
;
}
p_libvlc_global
->
p_module_bank
->
b_builtins
=
VLC_TRUE
;
vlc_mutex_unlock
(
lock
val
.
p_address
);
vlc_mutex_unlock
(
lock
);
msg_Dbg
(
p_this
,
"checking builtin modules"
);
ALLOCATE_ALL_BUILTINS
();
...
...
@@ -276,19 +267,16 @@ void __module_LoadBuiltins( vlc_object_t * p_this )
void
__module_LoadPlugins
(
vlc_object_t
*
p_this
)
{
#ifdef HAVE_DYNAMIC_PLUGINS
vlc_value_t
lockval
;
libvlc_global_data_t
*
p_libvlc_global
=
vlc_global
();
var_Create
(
p_libvlc_global
,
"libvlc"
,
VLC_VAR_MUTEX
);
var_Get
(
p_libvlc_global
,
"libvlc"
,
&
lockval
);
vlc_mutex_lock
(
lockval
.
p_address
);
vlc_mutex_t
*
lock
=
var_AcquireMutex
(
"libvlc"
);
if
(
p_libvlc_global
->
p_module_bank
->
b_plugins
)
{
vlc_mutex_unlock
(
lock
val
.
p_address
);
vlc_mutex_unlock
(
lock
);
return
;
}
p_libvlc_global
->
p_module_bank
->
b_plugins
=
VLC_TRUE
;
vlc_mutex_unlock
(
lock
val
.
p_address
);
vlc_mutex_unlock
(
lock
);
msg_Dbg
(
p_this
,
"checking plugin modules"
);
...
...
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