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
71c196e1
Commit
71c196e1
authored
Jun 03, 2009
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libvlc: Make sure no event will be send after _detach from the asynch thread.
parent
abe9af55
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
src/control/event_async.c
src/control/event_async.c
+26
-0
No files found.
src/control/event_async.c
View file @
71c196e1
...
...
@@ -22,6 +22,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <assert.h>
#include <vlc/libvlc.h>
#include "libvlc_internal.h"
...
...
@@ -38,6 +40,9 @@ struct libvlc_event_async_queue {
vlc_mutex_t
lock
;
vlc_cond_t
signal
;
vlc_thread_t
thread
;
bool
is_idle
;
vlc_cond_t
signal_idle
;
vlc_threadvar_t
is_asynch_dispatch_thread_var
;
};
/*
...
...
@@ -153,6 +158,8 @@ libvlc_event_async_fini(libvlc_event_manager_t * p_em)
vlc_mutex_destroy
(
&
queue
(
p_em
)
->
lock
);
vlc_cond_destroy
(
&
queue
(
p_em
)
->
signal
);
vlc_cond_destroy
(
&
queue
(
p_em
)
->
signal_idle
);
vlc_threadvar_delete
(
&
queue
(
p_em
)
->
is_asynch_dispatch_thread_var
);
struct
queue_elmt
*
iter
=
queue
(
p_em
)
->
elements
;
while
(
iter
)
{
...
...
@@ -184,6 +191,9 @@ libvlc_event_async_init(libvlc_event_manager_t * p_em)
vlc_mutex_init
(
&
queue
(
p_em
)
->
lock
);
vlc_cond_init
(
&
queue
(
p_em
)
->
signal
);
vlc_cond_init
(
&
queue
(
p_em
)
->
signal_idle
);
error
=
vlc_threadvar_create
(
&
queue
(
p_em
)
->
is_asynch_dispatch_thread_var
,
NULL
);
assert
(
!
error
);
}
/**************************************************************************
...
...
@@ -198,6 +208,15 @@ libvlc_event_async_ensure_listener_removal(libvlc_event_manager_t * p_em, libvlc
queue_lock
(
p_em
);
pop_listener
(
p_em
,
listener
);
bool
is_asynch_dispatch_thread
=
vlc_threadvar_get
(
queue
(
p_em
)
->
is_asynch_dispatch_thread_var
);
// Wait for the asynch_loop to have processed all events.
if
(
!
queue
(
p_em
)
->
is_idle
&&
!
is_asynch_dispatch_thread
)
{
vlc_cond_wait
(
&
queue
(
p_em
)
->
signal_idle
,
&
queue
(
p_em
)
->
lock
);
assert
(
queue
(
p_em
)
->
is_idle
);
}
queue_unlock
(
p_em
);
}
...
...
@@ -232,6 +251,8 @@ static void * event_async_loop(void * arg)
libvlc_event_listener_t
listener
;
libvlc_event_t
event
;
vlc_threadvar_set
(
queue
(
p_em
)
->
is_asynch_dispatch_thread_var
,
(
void
*
)
true
);
queue_lock
(
p_em
);
while
(
true
)
{
int
has_listener
=
pop
(
p_em
,
&
listener
,
&
event
);
...
...
@@ -244,9 +265,14 @@ static void * event_async_loop(void * arg)
}
else
{
queue
(
p_em
)
->
is_idle
=
true
;
mutex_cleanup_push
(
&
queue
(
p_em
)
->
lock
);
vlc_cond_broadcast
(
&
queue
(
p_em
)
->
signal_idle
);
// We'll be idle
vlc_cond_wait
(
&
queue
(
p_em
)
->
signal
,
&
queue
(
p_em
)
->
lock
);
vlc_cleanup_pop
();
queue
(
p_em
)
->
is_idle
=
false
;
}
}
queue_unlock
(
p_em
);
...
...
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