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
6eb8e599
Commit
6eb8e599
authored
May 19, 2011
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Converted ml_watch to vlc_clone().
parent
5a530e55
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
15 deletions
+10
-15
modules/media_library/ml_watch.c
modules/media_library/ml_watch.c
+9
-14
modules/media_library/sql_media_library.h
modules/media_library/sql_media_library.h
+1
-1
No files found.
modules/media_library/ml_watch.c
View file @
6eb8e599
...
@@ -29,7 +29,6 @@
...
@@ -29,7 +29,6 @@
#include "item_list.h"
#include "item_list.h"
#include <vlc_events.h>
#include <vlc_events.h>
static
void
*
watch_Thread
(
vlc_object_t
*
p_this
);
static
void
watch_ItemChange
(
const
vlc_event_t
*
,
void
*
);
static
void
watch_ItemChange
(
const
vlc_event_t
*
,
void
*
);
static
int
watch_PlaylistItemCurrent
(
vlc_object_t
*
p_this
,
char
const
*
psz_var
,
static
int
watch_PlaylistItemCurrent
(
vlc_object_t
*
p_this
,
char
const
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
...
@@ -49,19 +48,17 @@ static void watch_ProcessAppendQueue( media_library_t* p_ml );
...
@@ -49,19 +48,17 @@ static void watch_ProcessAppendQueue( media_library_t* p_ml );
/**
/**
* @brief Watching thread
* @brief Watching thread
*/
*/
static
void
*
watch_Thread
(
v
lc_object_t
*
p_this
)
static
void
*
watch_Thread
(
v
oid
*
obj
)
{
{
watch_thread_t
*
p_watch
=
(
watch_thread_t
*
)
p_this
;
watch_thread_t
*
p_watch
=
(
watch_thread_t
*
)
obj
;
media_library_t
*
p_ml
=
p_watch
->
p_ml
;
media_library_t
*
p_ml
=
p_watch
->
p_ml
;
int
i_ret
=
0
;
int
i_ret
=
0
;
vlc_mutex_lock
(
&
p_watch
->
lock
);
vlc_mutex_lock
(
&
p_watch
->
lock
);
vlc_cleanup_push
(
watch_Thread_Cleanup
,
p_ml
);
vlc_cleanup_push
(
watch_Thread_Cleanup
,
p_ml
);
while
(
vlc_object_alive
(
p_watch
)
)
for
(
;;
)
{
{
watch_loop
(
p_ml
,
!
i_ret
);
watch_loop
(
p_ml
,
!
i_ret
);
if
(
!
vlc_object_alive
(
p_watch
)
)
break
;
i_ret
=
vlc_cond_timedwait
(
&
p_watch
->
cond
,
&
p_watch
->
lock
,
i_ret
=
vlc_cond_timedwait
(
&
p_watch
->
cond
,
&
p_watch
->
lock
,
mdate
()
+
1000000
*
THREAD_SLEEP_DELAY
);
mdate
()
+
1000000
*
THREAD_SLEEP_DELAY
);
}
}
...
@@ -85,7 +82,7 @@ static void watch_Thread_Cleanup( void* p_object )
...
@@ -85,7 +82,7 @@ static void watch_Thread_Cleanup( void* p_object )
int
watch_Init
(
media_library_t
*
p_ml
)
int
watch_Init
(
media_library_t
*
p_ml
)
{
{
/* init and launch watching thread */
/* init and launch watching thread */
p_ml
->
p_sys
->
p_watch
=
vlc_object_create
(
p_ml
,
sizeof
(
watch_thread_t
)
);
p_ml
->
p_sys
->
p_watch
=
calloc
(
1
,
sizeof
(
*
p_ml
->
p_sys
->
p_watch
)
);
if
(
!
p_ml
->
p_sys
->
p_watch
)
if
(
!
p_ml
->
p_sys
->
p_watch
)
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
...
@@ -93,15 +90,13 @@ int watch_Init( media_library_t *p_ml )
...
@@ -93,15 +90,13 @@ int watch_Init( media_library_t *p_ml )
vlc_mutex_init
(
&
p_wt
->
list_mutex
);
vlc_mutex_init
(
&
p_wt
->
list_mutex
);
p_wt
->
p_ml
=
p_ml
;
p_wt
->
p_ml
=
p_ml
;
vlc_object_attach
(
p_wt
,
p_ml
);
vlc_cond_init
(
&
p_wt
->
cond
);
vlc_cond_init
(
&
p_wt
->
cond
);
vlc_mutex_init
(
&
p_wt
->
lock
);
vlc_mutex_init
(
&
p_wt
->
lock
);
if
(
vlc_
thread_create
(
p_wt
,
watch_Thread
,
VLC_THREAD_PRIORITY_LOW
)
)
if
(
vlc_
clone
(
&
p_wt
->
thread
,
watch_Thread
,
p_wt
,
VLC_THREAD_PRIORITY_LOW
)
)
{
{
msg_Dbg
(
p_ml
,
"unable to launch the auto-updating thread"
);
msg_Dbg
(
p_ml
,
"unable to launch the auto-updating thread"
);
vlc_object_releas
e
(
p_wt
);
fre
e
(
p_wt
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -186,14 +181,14 @@ void watch_Close( media_library_t *p_ml )
...
@@ -186,14 +181,14 @@ void watch_Close( media_library_t *p_ml )
item_list_destroy
(
p_ml
->
p_sys
->
p_watch
);
item_list_destroy
(
p_ml
->
p_sys
->
p_watch
);
/* Stop the watch thread and join in */
/* Stop the watch thread and join in */
vlc_
object_kill
(
p_ml
->
p_sys
->
p_watch
);
vlc_
cancel
(
p_ml
->
p_sys
->
p_watch
->
thread
);
vlc_
thread_join
(
p_ml
->
p_sys
->
p_watch
);
vlc_
join
(
p_ml
->
p_sys
->
p_watch
->
thread
,
NULL
);
/* Clear up other stuff */
/* Clear up other stuff */
vlc_mutex_destroy
(
&
p_ml
->
p_sys
->
p_watch
->
lock
);
vlc_mutex_destroy
(
&
p_ml
->
p_sys
->
p_watch
->
lock
);
vlc_cond_destroy
(
&
p_ml
->
p_sys
->
p_watch
->
cond
);
vlc_cond_destroy
(
&
p_ml
->
p_sys
->
p_watch
->
cond
);
vlc_mutex_destroy
(
&
p_ml
->
p_sys
->
p_watch
->
list_mutex
);
vlc_mutex_destroy
(
&
p_ml
->
p_sys
->
p_watch
->
list_mutex
);
vlc_object_releas
e
(
p_ml
->
p_sys
->
p_watch
);
fre
e
(
p_ml
->
p_sys
->
p_watch
);
free
(
p_ml
->
p_sys
->
p_watch
->
item_append_queue
);
free
(
p_ml
->
p_sys
->
p_watch
->
item_append_queue
);
vlc_mutex_destroy
(
&
p_ml
->
p_sys
->
p_watch
->
item_append_queue_lock
);
vlc_mutex_destroy
(
&
p_ml
->
p_sys
->
p_watch
->
item_append_queue_lock
);
...
...
modules/media_library/sql_media_library.h
View file @
6eb8e599
...
@@ -118,8 +118,8 @@ struct monitoring_thread_t
...
@@ -118,8 +118,8 @@ struct monitoring_thread_t
/* Media status Watching thread */
/* Media status Watching thread */
struct
watch_thread_t
struct
watch_thread_t
{
{
VLC_COMMON_MEMBERS
;
media_library_t
*
p_ml
;
media_library_t
*
p_ml
;
vlc_thread_t
thread
;
vlc_cond_t
cond
;
vlc_cond_t
cond
;
vlc_mutex_t
lock
;
vlc_mutex_t
lock
;
...
...
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