Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GSoC
GSoC2018
macOS
vlc
Commits
6a627ce8
Commit
6a627ce8
authored
Mar 29, 2017
by
Hugo Beauzée-Luyssen
Browse files
lua: Properly support reactivation of the extension
parent
04da2f73
Changes
2
Hide whitespace changes
Inline
Side-by-side
modules/lua/extension.c
View file @
6a627ce8
...
...
@@ -140,11 +140,23 @@ void Close_Extension( vlc_object_t *p_this )
break
;
vlc_mutex_lock
(
&
p_ext
->
p_sys
->
command_lock
);
bool
b_activated
=
p_ext
->
p_sys
->
b_activated
;
vlc_mutex_unlock
(
&
p_ext
->
p_sys
->
command_lock
);
if
(
b_activated
==
true
)
if
(
p_ext
->
p_sys
->
b_activated
==
true
)
{
p_ext
->
p_sys
->
b_exiting
=
true
;
vlc_mutex_unlock
(
&
p_ext
->
p_sys
->
command_lock
);
// DeactivateCommand will signal the wait condition.
Deactivate
(
p_mgr
,
p_ext
);
}
else
{
if
(
p_ext
->
p_sys
->
L
!=
NULL
)
vlclua_fd_interrupt
(
&
p_ext
->
p_sys
->
dtable
);
// however here we need to manually signal the wait cond, since no command is queued.
p_ext
->
p_sys
->
b_exiting
=
true
;
vlc_cond_signal
(
&
p_ext
->
p_sys
->
wait
);
vlc_mutex_unlock
(
&
p_ext
->
p_sys
->
command_lock
);
}
if
(
p_ext
->
p_sys
->
b_thread_running
==
true
)
vlc_join
(
p_ext
->
p_sys
->
thread
,
NULL
);
...
...
modules/lua/extension_thread.c
View file @
6a627ce8
...
...
@@ -52,17 +52,30 @@ int Activate( extensions_manager_t *p_mgr, extension_t *p_ext )
struct
extension_sys_t
*
p_sys
=
p_ext
->
p_sys
;
assert
(
p_sys
!=
NULL
);
msg_Dbg
(
p_mgr
,
"Activating extension '%s'"
,
p_ext
->
psz_title
);
vlc_mutex_lock
(
&
p_sys
->
command_lock
);
if
(
p_sys
->
b_activated
==
false
)
{
/* Prepare first command */
assert
(
p_sys
->
command
==
NULL
);
p_sys
->
command
=
calloc
(
1
,
sizeof
(
struct
command_t
)
);
if
(
!
p_sys
->
command
)
{
vlc_mutex_unlock
(
&
p_sys
->
command_lock
);
return
VLC_ENOMEM
;
}
p_sys
->
command
->
i_command
=
CMD_ACTIVATE
;
/* No params */
if
(
p_sys
->
b_thread_running
==
true
)
{
msg_Dbg
(
p_mgr
,
"Reactivating extension %s"
,
p_ext
->
psz_title
);
vlc_cond_signal
(
&
p_sys
->
wait
);
}
}
vlc_mutex_unlock
(
&
p_sys
->
command_lock
);
if
(
p_sys
->
b_thread_running
==
true
)
return
VLC_SUCCESS
;
/* Prepare first command */
p_sys
->
command
=
calloc
(
1
,
sizeof
(
struct
command_t
)
);
if
(
!
p_sys
->
command
)
return
VLC_ENOMEM
;
p_sys
->
command
->
i_command
=
CMD_ACTIVATE
;
/* No params */
msg_Dbg
(
p_mgr
,
"Activating extension '%s'"
,
p_ext
->
psz_title
);
/* Start thread */
p_sys
->
b_exiting
=
false
;
p_sys
->
b_thread_running
=
true
;
...
...
@@ -293,7 +306,6 @@ static void* Run( void *data )
p_ext
->
psz_title
);
}
vlc_mutex_lock
(
&
p_ext
->
p_sys
->
command_lock
);
p_ext
->
p_sys
->
b_exiting
=
true
;
p_ext
->
p_sys
->
b_activated
=
false
;
vlc_mutex_unlock
(
&
p_ext
->
p_sys
->
command_lock
);
break
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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