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
7d7890ed
Commit
7d7890ed
authored
Jun 16, 2013
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lua: SD: simplify thread loop
parent
9ba5f88e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
20 deletions
+14
-20
modules/lua/services_discovery.c
modules/lua/services_discovery.c
+14
-20
No files found.
modules/lua/services_discovery.c
View file @
7d7890ed
...
@@ -52,7 +52,6 @@ struct services_discovery_sys_t
...
@@ -52,7 +52,6 @@ struct services_discovery_sys_t
vlc_thread_t
thread
;
vlc_thread_t
thread
;
vlc_mutex_t
lock
;
vlc_mutex_t
lock
;
vlc_cond_t
cond
;
vlc_cond_t
cond
;
bool
b_exiting
;
char
**
ppsz_query
;
char
**
ppsz_query
;
int
i_query
;
int
i_query
;
...
@@ -135,7 +134,6 @@ int Open_LuaSD( vlc_object_t *p_this )
...
@@ -135,7 +134,6 @@ int Open_LuaSD( vlc_object_t *p_this )
p_sys
->
L
=
L
;
p_sys
->
L
=
L
;
vlc_mutex_init
(
&
p_sys
->
lock
);
vlc_mutex_init
(
&
p_sys
->
lock
);
vlc_cond_init
(
&
p_sys
->
cond
);
vlc_cond_init
(
&
p_sys
->
cond
);
p_sys
->
b_exiting
=
false
;
TAB_INIT
(
p_sys
->
i_query
,
p_sys
->
ppsz_query
);
TAB_INIT
(
p_sys
->
i_query
,
p_sys
->
ppsz_query
);
if
(
vlc_clone
(
&
p_sys
->
thread
,
Run
,
p_sd
,
VLC_THREAD_PRIORITY_LOW
)
)
if
(
vlc_clone
(
&
p_sys
->
thread
,
Run
,
p_sd
,
VLC_THREAD_PRIORITY_LOW
)
)
...
@@ -163,10 +161,6 @@ void Close_LuaSD( vlc_object_t *p_this )
...
@@ -163,10 +161,6 @@ void Close_LuaSD( vlc_object_t *p_this )
services_discovery_t
*
p_sd
=
(
services_discovery_t
*
)
p_this
;
services_discovery_t
*
p_sd
=
(
services_discovery_t
*
)
p_this
;
services_discovery_sys_t
*
p_sys
=
p_sd
->
p_sys
;
services_discovery_sys_t
*
p_sys
=
p_sd
->
p_sys
;
vlc_mutex_lock
(
&
p_sys
->
lock
);
p_sys
->
b_exiting
=
true
;
vlc_mutex_unlock
(
&
p_sys
->
lock
);
vlc_cancel
(
p_sys
->
thread
);
vlc_cancel
(
p_sys
->
thread
);
vlc_join
(
p_sys
->
thread
,
NULL
);
vlc_join
(
p_sys
->
thread
,
NULL
);
...
@@ -213,29 +207,29 @@ static void* Run( void *data )
...
@@ -213,29 +207,29 @@ static void* Run( void *data )
/* Main loop to handle search requests */
/* Main loop to handle search requests */
vlc_mutex_lock
(
&
p_sys
->
lock
);
vlc_mutex_lock
(
&
p_sys
->
lock
);
mutex_cleanup_push
(
&
p_sys
->
lock
);
mutex_cleanup_push
(
&
p_sys
->
lock
);
while
(
!
p_sys
->
b_exiting
)
for
(
;;
)
{
{
/* Wait for a request */
/* Wait for a request */
while
(
!
p_sys
->
i_query
)
if
(
!
p_sys
->
i_query
)
{
vlc_cond_wait
(
&
p_sys
->
cond
,
&
p_sys
->
lock
);
vlc_cond_wait
(
&
p_sys
->
cond
,
&
p_sys
->
lock
);
continue
;
}
/* Execute every query each one protected against cancelation */
/* Execute one query (protected against cancellation) */
cancel
=
vlc_savecancel
();
while
(
!
p_sys
->
b_exiting
&&
p_sys
->
i_query
)
{
char
*
psz_query
=
p_sys
->
ppsz_query
[
p_sys
->
i_query
-
1
];
char
*
psz_query
=
p_sys
->
ppsz_query
[
p_sys
->
i_query
-
1
];
REMOVE_ELEM
(
p_sys
->
ppsz_query
,
p_sys
->
i_query
,
p_sys
->
i_query
-
1
);
REMOVE_ELEM
(
p_sys
->
ppsz_query
,
p_sys
->
i_query
,
p_sys
->
i_query
-
1
);
vlc_mutex_unlock
(
&
p_sys
->
lock
);
vlc_mutex_unlock
(
&
p_sys
->
lock
);
cancel
=
vlc_savecancel
();
DoSearch
(
p_sd
,
psz_query
);
DoSearch
(
p_sd
,
psz_query
);
free
(
psz_query
);
free
(
psz_query
);
vlc_mutex_lock
(
&
p_sys
->
lock
);
}
/* Force garbage collection, because the core will keep the SD
/* Force garbage collection, because the core will keep the SD
* open, but lua will never gc until lua_close(). */
* open, but lua will never gc until lua_close(). */
lua_gc
(
L
,
LUA_GCCOLLECT
,
0
);
lua_gc
(
L
,
LUA_GCCOLLECT
,
0
);
vlc_restorecancel
(
cancel
);
vlc_restorecancel
(
cancel
);
vlc_mutex_lock
(
&
p_sys
->
lock
);
}
}
vlc_cleanup_run
();
vlc_cleanup_run
();
...
...
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