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
6f2119ef
Commit
6f2119ef
authored
Oct 13, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Timer: make the overrun counter atomic
parent
d25fd8d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
13 deletions
+6
-13
src/misc/pthread.c
src/misc/pthread.c
+6
-13
No files found.
src/misc/pthread.c
View file @
6f2119ef
...
...
@@ -29,6 +29,7 @@
#endif
#include <vlc_common.h>
#include <vlc_atomic.h>
#include "libvlc.h"
#include <stdarg.h>
...
...
@@ -805,7 +806,7 @@ struct vlc_timer
void
*
data
;
mtime_t
value
,
interval
;
unsigned
users
;
unsigned
overruns
;
vlc_atomic_t
overruns
;
};
static
void
*
vlc_timer_do
(
void
*
data
)
...
...
@@ -840,7 +841,7 @@ static void *vlc_timer_thread (void *data)
vlc_mutex_lock
(
&
timer
->
lock
);
if
(
vlc_clone
(
&
th
,
vlc_timer_do
,
timer
,
VLC_THREAD_PRIORITY_INPUT
))
timer
->
overruns
++
;
vlc_atomic_inc
(
&
timer
->
overruns
)
;
else
{
vlc_detach
(
th
);
...
...
@@ -859,9 +860,7 @@ static void *vlc_timer_thread (void *data)
if
(
misses
>
1
)
{
misses
--
;
vlc_mutex_lock
(
&
timer
->
lock
);
timer
->
overruns
+=
misses
;
vlc_mutex_unlock
(
&
timer
->
lock
);
vlc_atomic_add
(
&
timer
->
overruns
,
misses
);
value
+=
misses
*
interval
;
}
value
+=
interval
;
...
...
@@ -892,7 +891,7 @@ int vlc_timer_create (vlc_timer_t *id, void (*func) (void *), void *data)
timer
->
value
=
0
;
timer
->
interval
=
0
;
timer
->
users
=
0
;
timer
->
overruns
=
0
;
vlc_atomic_set
(
&
timer
->
overruns
,
0
)
;
*
id
=
timer
;
return
0
;
}
...
...
@@ -970,11 +969,5 @@ void vlc_timer_schedule (vlc_timer_t timer, bool absolute,
*/
unsigned
vlc_timer_getoverrun
(
vlc_timer_t
timer
)
{
unsigned
ret
;
vlc_mutex_lock
(
&
timer
->
lock
);
ret
=
timer
->
overruns
;
timer
->
overruns
=
0
;
vlc_mutex_unlock
(
&
timer
->
lock
);
return
ret
;
return
vlc_atomic_swap
(
&
timer
->
overruns
,
0
);
}
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