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
8cfa47d2
Commit
8cfa47d2
authored
Feb 25, 2008
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
control/event.c: Make it pass the unit tests.
parent
719fa35e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
6 deletions
+44
-6
src/control/event.c
src/control/event.c
+44
-6
No files found.
src/control/event.c
View file @
8cfa47d2
...
...
@@ -31,6 +31,28 @@
* Private functions
*/
static
vlc_bool_t
listeners_are_equal
(
libvlc_event_listener_t
*
listener1
,
libvlc_event_listener_t
*
listener2
)
{
return
listener1
->
event_type
==
listener2
->
event_type
&&
listener1
->
pf_callback
==
listener2
->
pf_callback
&&
listener1
->
p_user_data
==
listener2
->
p_user_data
;
}
static
vlc_bool_t
group_contains_listener
(
libvlc_event_listeners_group_t
*
group
,
libvlc_event_listener_t
*
searched_listener
)
{
int
i
;
for
(
i
=
0
;
i
<
vlc_array_count
(
&
group
->
listeners
);
i
++
)
{
if
(
listeners_are_equal
(
searched_listener
,
vlc_array_item_at_index
(
&
group
->
listeners
,
i
))
)
return
VLC_TRUE
;
}
return
VLC_FALSE
;
}
/*
* Internal libvlc functions
*/
...
...
@@ -79,7 +101,7 @@ libvlc_event_manager_new( void * p_obj, libvlc_instance_t * p_libvlc_inst,
libvlc_retain
(
p_libvlc_inst
);
vlc_array_init
(
&
p_em
->
listeners_groups
);
vlc_mutex_init
(
p_libvlc_inst
->
p_libvlc_int
,
&
p_em
->
object_lock
);
vlc_mutex_init
(
p_libvlc_inst
->
p_libvlc_int
,
&
p_em
->
event_sending_lock
);
vlc_mutex_init
_recursive
(
p_libvlc_inst
->
p_libvlc_int
,
&
p_em
->
event_sending_lock
);
return
p_em
;
}
...
...
@@ -185,17 +207,33 @@ void libvlc_event_send( libvlc_event_manager_t * p_em,
}
}
if
(
!
listeners_group
)
{
free
(
array_listeners_cached
);
return
;
}
vlc_mutex_unlock
(
&
p_em
->
object_lock
);
/* Here a read/write lock would be *especially* nice,
* We would be able to send event without blocking */
/* The only reason for this lock is to be able to wait the
* End of events sending with libvlc_event_manager_lock_event_sending.
* This can be useful to make sure a callback is completely detached. */
vlc_mutex_lock
(
&
p_em
->
event_sending_lock
);
listener_cached
=
array_listeners_cached
;
listeners_group
->
b_sublistener_removed
=
VLC_FALSE
;
for
(
i
=
0
;
i
<
i_cached_listeners
;
i
++
)
{
if
(
listeners_group
->
b_sublistener_removed
)
{
/* If a callback was removed, this gets called */
vlc_bool_t
valid_listener
;
vlc_mutex_lock
(
&
p_em
->
object_lock
);
valid_listener
=
group_contains_listener
(
listeners_group
,
listener_cached
);
vlc_mutex_unlock
(
&
p_em
->
object_lock
);
if
(
!
valid_listener
)
{
listener_cached
++
;
continue
;
}
}
listener_cached
->
pf_callback
(
p_event
,
listener_cached
->
p_user_data
);
listener_cached
++
;
}
...
...
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