Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
a056e64e
Commit
a056e64e
authored
May 19, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mwait/mdate: remove cached_time - not thread-safe
Could go badly wrong on platforms without atomic 64-bits access
parent
e2b38c96
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
12 deletions
+3
-12
src/misc/mtime.c
src/misc/mtime.c
+3
-12
No files found.
src/misc/mtime.c
View file @
a056e64e
...
...
@@ -172,8 +172,6 @@ static inline unsigned mprec( void )
#endif
}
static
volatile
mtime_t
cached_time
=
0
;
/**
* Return high precision date
*
...
...
@@ -313,7 +311,7 @@ mtime_t mdate( void )
res
=
(
mtime_t
)
tv_date
.
tv_sec
*
1000000
+
(
mtime_t
)
tv_date
.
tv_usec
;
#endif
return
cached_time
=
res
;
return
res
;
}
/**
...
...
@@ -327,9 +325,8 @@ mtime_t mdate( void )
void
mwait
(
mtime_t
date
)
{
/* If the deadline is already elapsed, or within the clock precision,
* do not even bother the clock. */
if
(
(
date
-
cached_time
)
<
(
mtime_t
)
mprec
()
)
// OK: mtime_t is signed
return
;
* do not even bother the system timer. */
date
-=
mprec
();
#if 0 && defined (HAVE_CLOCK_NANOSLEEP)
lldiv_t d = lldiv( date, 1000000 );
...
...
@@ -360,8 +357,6 @@ void mwait( mtime_t date )
*/
void
msleep
(
mtime_t
delay
)
{
mtime_t
earlier
=
cached_time
;
#if defined( HAVE_CLOCK_NANOSLEEP )
lldiv_t
d
=
lldiv
(
delay
,
1000000
);
struct
timespec
ts
=
{
d
.
quot
,
d
.
rem
*
1000
};
...
...
@@ -398,10 +393,6 @@ void msleep( mtime_t delay )
* or clock_nanosleep() if this is an issue. */
select
(
0
,
NULL
,
NULL
,
NULL
,
&
tv_delay
);
#endif
earlier
+=
delay
;
if
(
cached_time
<
earlier
)
cached_time
=
earlier
;
}
/*
...
...
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