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
9f49f111
Commit
9f49f111
authored
Jan 28, 2010
by
Jean-Philippe André
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extensions: fix extensions manager's locking scheme
parent
dbd4f0cc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
11 deletions
+17
-11
include/vlc_extensions.h
include/vlc_extensions.h
+1
-0
modules/misc/lua/extension.c
modules/misc/lua/extension.c
+10
-10
modules/misc/lua/extension.h
modules/misc/lua/extension.h
+4
-1
modules/misc/lua/extension_thread.c
modules/misc/lua/extension_thread.c
+2
-0
No files found.
include/vlc_extensions.h
View file @
9f49f111
...
@@ -48,6 +48,7 @@ struct extensions_manager_t
...
@@ -48,6 +48,7 @@ struct extensions_manager_t
extensions_manager_sys_t
*
p_sys
;
/**< Reserved for the module */
extensions_manager_sys_t
*
p_sys
;
/**< Reserved for the module */
DECL_ARRAY
(
extension_t
*
)
extensions
;
/**< Array of extension descriptors */
DECL_ARRAY
(
extension_t
*
)
extensions
;
/**< Array of extension descriptors */
vlc_mutex_t
lock
;
/**< A lock for the extensions array */
/** Control, see extension_Control */
/** Control, see extension_Control */
int
(
*
pf_control
)
(
extensions_manager_t
*
,
int
,
va_list
);
int
(
*
pf_control
)
(
extensions_manager_t
*
,
int
,
va_list
);
...
...
modules/misc/lua/extension.c
View file @
9f49f111
...
@@ -85,6 +85,7 @@ int Open_Extension( vlc_object_t *p_this )
...
@@ -85,6 +85,7 @@ int Open_Extension( vlc_object_t *p_this )
p_mgr
->
p_sys
=
p_sys
;
p_mgr
->
p_sys
=
p_sys
;
ARRAY_INIT
(
p_sys
->
activated_extensions
);
ARRAY_INIT
(
p_sys
->
activated_extensions
);
ARRAY_INIT
(
p_mgr
->
extensions
);
ARRAY_INIT
(
p_mgr
->
extensions
);
vlc_mutex_init
(
&
p_mgr
->
lock
);
vlc_mutex_init
(
&
p_mgr
->
p_sys
->
lock
);
vlc_mutex_init
(
&
p_mgr
->
p_sys
->
lock
);
/* Initialise Lua state structure */
/* Initialise Lua state structure */
...
@@ -106,8 +107,6 @@ int Open_Extension( vlc_object_t *p_this )
...
@@ -106,8 +107,6 @@ int Open_Extension( vlc_object_t *p_this )
lua_close
(
L
);
lua_close
(
L
);
p_sys
->
L
=
NULL
;
p_sys
->
L
=
NULL
;
vlc_mutex_init
(
&
p_sys
->
lock
);
// Create the dialog-event variable
// Create the dialog-event variable
var_Create
(
p_this
,
"dialog-event"
,
VLC_VAR_ADDRESS
);
var_Create
(
p_this
,
"dialog-event"
,
VLC_VAR_ADDRESS
);
var_AddCallback
(
p_this
,
"dialog-event"
,
var_AddCallback
(
p_this
,
"dialog-event"
,
...
@@ -124,9 +123,11 @@ void Close_Extension( vlc_object_t *p_this )
...
@@ -124,9 +123,11 @@ void Close_Extension( vlc_object_t *p_this )
extensions_manager_t
*
p_mgr
=
(
extensions_manager_t
*
)
p_this
;
extensions_manager_t
*
p_mgr
=
(
extensions_manager_t
*
)
p_this
;
msg_Dbg
(
p_mgr
,
"Deactivating all loaded extensions"
);
msg_Dbg
(
p_mgr
,
"Deactivating all loaded extensions"
);
vlc_mutex_lock
(
&
p_mgr
->
p_sys
->
lock
);
vlc_mutex_lock
(
&
p_mgr
->
lock
);
p_mgr
->
p_sys
->
b_killed
=
true
;
p_mgr
->
p_sys
->
b_killed
=
true
;
vlc_mutex_unlock
(
&
p_mgr
->
p_sys
->
lock
);
vlc_mutex_unlock
(
&
p_mgr
->
lock
);
var_Destroy
(
p_mgr
,
"dialog-event"
);
extension_t
*
p_ext
=
NULL
;
extension_t
*
p_ext
=
NULL
;
FOREACH_ARRAY
(
p_ext
,
p_mgr
->
p_sys
->
activated_extensions
)
FOREACH_ARRAY
(
p_ext
,
p_mgr
->
p_sys
->
activated_extensions
)
...
@@ -143,6 +144,7 @@ void Close_Extension( vlc_object_t *p_this )
...
@@ -143,6 +144,7 @@ void Close_Extension( vlc_object_t *p_this )
if
(
p_mgr
->
p_sys
&&
p_mgr
->
p_sys
->
L
)
if
(
p_mgr
->
p_sys
&&
p_mgr
->
p_sys
->
L
)
lua_close
(
p_mgr
->
p_sys
->
L
);
lua_close
(
p_mgr
->
p_sys
->
L
);
vlc_mutex_destroy
(
&
p_mgr
->
lock
);
vlc_mutex_destroy
(
&
p_mgr
->
p_sys
->
lock
);
vlc_mutex_destroy
(
&
p_mgr
->
p_sys
->
lock
);
free
(
p_mgr
->
p_sys
);
free
(
p_mgr
->
p_sys
);
p_mgr
->
p_sys
=
NULL
;
p_mgr
->
p_sys
=
NULL
;
...
@@ -167,8 +169,6 @@ void Close_Extension( vlc_object_t *p_this )
...
@@ -167,8 +169,6 @@ void Close_Extension( vlc_object_t *p_this )
FOREACH_END
()
FOREACH_END
()
ARRAY_RESET
(
p_mgr
->
extensions
);
ARRAY_RESET
(
p_mgr
->
extensions
);
var_Destroy
(
p_mgr
,
"dialog-event"
);
}
}
/**
/**
...
@@ -205,13 +205,13 @@ int ScanLuaCallback( vlc_object_t *p_this, const char *psz_script,
...
@@ -205,13 +205,13 @@ int ScanLuaCallback( vlc_object_t *p_this, const char *psz_script,
msg_Dbg
(
p_mgr
,
"Scanning Lua script %s"
,
psz_script
);
msg_Dbg
(
p_mgr
,
"Scanning Lua script %s"
,
psz_script
);
vlc_mutex_lock
(
&
p_mgr
->
p_sys
->
lock
);
vlc_mutex_lock
(
&
p_mgr
->
lock
);
/* Create new script descriptor */
/* Create new script descriptor */
extension_t
*
p_ext
=
(
extension_t
*
)
calloc
(
1
,
sizeof
(
extension_t
)
);
extension_t
*
p_ext
=
(
extension_t
*
)
calloc
(
1
,
sizeof
(
extension_t
)
);
if
(
!
p_ext
)
if
(
!
p_ext
)
{
{
vlc_mutex_unlock
(
&
p_mgr
->
p_sys
->
lock
);
vlc_mutex_unlock
(
&
p_mgr
->
lock
);
return
0
;
return
0
;
}
}
...
@@ -222,7 +222,7 @@ int ScanLuaCallback( vlc_object_t *p_this, const char *psz_script,
...
@@ -222,7 +222,7 @@ int ScanLuaCallback( vlc_object_t *p_this, const char *psz_script,
free
(
p_ext
->
psz_name
);
free
(
p_ext
->
psz_name
);
free
(
p_ext
->
p_sys
);
free
(
p_ext
->
p_sys
);
free
(
p_ext
);
free
(
p_ext
);
vlc_mutex_unlock
(
&
p_mgr
->
p_sys
->
lock
);
vlc_mutex_unlock
(
&
p_mgr
->
lock
);
return
0
;
return
0
;
}
}
p_ext
->
p_sys
->
p_mgr
=
p_mgr
;
p_ext
->
p_sys
->
p_mgr
=
p_mgr
;
...
@@ -350,7 +350,7 @@ exit:
...
@@ -350,7 +350,7 @@ exit:
ARRAY_APPEND
(
p_mgr
->
extensions
,
p_ext
);
ARRAY_APPEND
(
p_mgr
->
extensions
,
p_ext
);
}
}
vlc_mutex_unlock
(
&
p_mgr
->
p_sys
->
lock
);
vlc_mutex_unlock
(
&
p_mgr
->
lock
);
/* Continue batch execution */
/* Continue batch execution */
return
pb_continue
?
(
(
*
(
bool
*
)
pb_continue
)
?
-
1
:
0
)
:
-
1
;
return
pb_continue
?
(
(
*
(
bool
*
)
pb_continue
)
?
-
1
:
0
)
:
-
1
;
}
}
...
...
modules/misc/lua/extension.h
View file @
9f49f111
...
@@ -42,10 +42,13 @@ struct extensions_manager_sys_t
...
@@ -42,10 +42,13 @@ struct extensions_manager_sys_t
/* List of activated extensions */
/* List of activated extensions */
DECL_ARRAY
(
extension_t
*
)
activated_extensions
;
DECL_ARRAY
(
extension_t
*
)
activated_extensions
;
/* Lock for this list */
vlc_mutex_t
lock
;
/* Lua specific */
/* Lua specific */
lua_State
*
L
;
lua_State
*
L
;
vlc_mutex_t
lock
;
/* Flag indicating that the module is about to be unloaded */
bool
b_killed
;
bool
b_killed
;
};
};
...
...
modules/misc/lua/extension_thread.c
View file @
9f49f111
...
@@ -60,7 +60,9 @@ int Activate( extensions_manager_t *p_mgr, extension_t *p_ext )
...
@@ -60,7 +60,9 @@ int Activate( extensions_manager_t *p_mgr, extension_t *p_ext )
}
}
/* Add this script to the activated extensions list */
/* Add this script to the activated extensions list */
vlc_mutex_lock
(
&
p_mgr
->
p_sys
->
lock
);
ARRAY_APPEND
(
p_mgr
->
p_sys
->
activated_extensions
,
p_ext
);
ARRAY_APPEND
(
p_mgr
->
p_sys
->
activated_extensions
,
p_ext
);
vlc_mutex_unlock
(
&
p_mgr
->
p_sys
->
lock
);
/* Prepare first command */
/* Prepare first command */
p_sys
->
command
=
calloc
(
1
,
sizeof
(
struct
command_t
)
);
p_sys
->
command
=
calloc
(
1
,
sizeof
(
struct
command_t
)
);
...
...
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