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
7cc631ac
Commit
7cc631ac
authored
Sep 04, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add msleep misuse warning
parent
822412bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
src/misc/mtime.c
src/misc/mtime.c
+24
-0
No files found.
src/misc/mtime.c
View file @
7cc631ac
...
@@ -360,6 +360,9 @@ void mwait( mtime_t date )
...
@@ -360,6 +360,9 @@ void mwait( mtime_t date )
#endif
#endif
}
}
#include "libvlc.h"
/* vlc_backtrace() */
/**
/**
* Portable usleep(). Cancellation point.
* Portable usleep(). Cancellation point.
*
*
...
@@ -367,6 +370,27 @@ void mwait( mtime_t date )
...
@@ -367,6 +370,27 @@ void mwait( mtime_t date )
*/
*/
void
msleep
(
mtime_t
delay
)
void
msleep
(
mtime_t
delay
)
{
{
#ifndef NDEBUG
# if defined (__linux__) || defined (WIN32)
/* We assume that proper use of msleep() will not use a constant period...
* Media synchronization is likely to use mwait() with at least slight
* sleep length variation at microsecond precision. Network protocols
* normally have exponential backoffs, or long delays. */
static
__thread
unsigned
tick_period
=
0
;
static
__thread
unsigned
tick_frequency
=
0
;
if
(
tick_period
!=
delay
)
tick_frequency
=
0
;
tick_frequency
++
;
tick_period
=
delay
;
if
(
delay
<
(
29
*
CLOCK_FREQ
)
&&
tick_frequency
==
20
)
{
fprintf
(
stderr
,
"Likely bogus delay(%"
PRIu64
"µs) "
,
delay
);
vlc_backtrace
();
}
//fprintf (stderr, "%u, %u\n", tick_period, tick_frequency);
# endif
#endif
#if defined( HAVE_CLOCK_NANOSLEEP )
#if defined( HAVE_CLOCK_NANOSLEEP )
lldiv_t
d
=
lldiv
(
delay
,
1000000
);
lldiv_t
d
=
lldiv
(
delay
,
1000000
);
struct
timespec
ts
=
{
d
.
quot
,
d
.
rem
*
1000
};
struct
timespec
ts
=
{
d
.
quot
,
d
.
rem
*
1000
};
...
...
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