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
e516ddb1
Commit
e516ddb1
authored
Sep 07, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rework delay checking, use it for net_Accept, add deadline checks
parent
6db8a5e0
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
13 deletions
+33
-13
include/vlc_mtime.h
include/vlc_mtime.h
+27
-9
include/vlc_network.h
include/vlc_network.h
+2
-1
include/vlc_objects.h
include/vlc_objects.h
+1
-1
include/vlc_threads.h
include/vlc_threads.h
+2
-2
src/misc/mtime.c
src/misc/mtime.c
+1
-0
No files found.
include/vlc_mtime.h
View file @
e516ddb1
...
...
@@ -80,31 +80,49 @@ static
__attribute__
((
unused
))
__attribute__
((
noinline
))
__attribute__
((
error
(
"sorry, cannot sleep for such short a time"
)))
void
impossible_msleep
(
mtime_t
delay
)
mtime_t
impossible_delay
(
mtime_t
delay
)
{
(
void
)
delay
;
msleep
(
VLC_HARD_MIN_SLEEP
)
;
return
VLC_HARD_MIN_SLEEP
;
}
static
__attribute__
((
unused
))
__attribute__
((
noinline
))
__attribute__
((
warning
(
"use proper event handling instead"
)))
void
bad_msleep
(
mtime_t
delay
)
__attribute__
((
warning
(
"use proper event handling instead
of short delay
"
)))
mtime_t
harmful_delay
(
mtime_t
delay
)
{
msleep
(
delay
)
;
return
delay
;
}
# define
msleep
( d ) \
# define
check_delay
( d ) \
((__builtin_constant_p(d < VLC_HARD_MIN_SLEEP) \
&& (d < VLC_HARD_MIN_SLEEP)) \
? impossible_
msleep
(d) \
? impossible_
delay
(d) \
: ((__builtin_constant_p(d < VLC_SOFT_MIN_SLEEP) \
&& (d < VLC_SOFT_MIN_SLEEP)) \
? bad_msleep(d) \
: msleep(d)))
? harmful_delay(d) \
: d))
static
__attribute__
((
unused
))
__attribute__
((
noinline
))
__attribute__
((
error
(
"deadlines can not be constant"
)))
mtime_t
impossible_deadline
(
mtime_t
deadline
)
{
return
deadline
;
}
# define check_deadline( d ) \
(__builtin_constant_p(d) ? impossible_deadline(d) : d)
#else
# define check_delay(d) (d)
# define check_deadline(d) (d)
#endif
#define msleep(d) msleep(check_delay(d))
#define mwait(d) mwait(check_deadline(d))
/*****************************************************************************
* date_t: date incrementation without long-term rounding errors
*****************************************************************************/
...
...
include/vlc_network.h
View file @
e516ddb1
...
...
@@ -107,8 +107,9 @@ static inline int __net_ConnectTCP (vlc_object_t *obj, const char *host, int por
VLC_EXPORT
(
int
,
net_AcceptSingle
,
(
vlc_object_t
*
obj
,
int
lfd
)
);
#define net_Accept(a, b, c) __net_Accept(VLC_OBJECT(a), b, c)
VLC_EXPORT
(
int
,
__net_Accept
,
(
vlc_object_t
*
,
int
*
,
mtime_t
)
);
#define net_Accept(a, b, c) \
__net_Accept(VLC_OBJECT(a), b, c ? check_delay(c) : 0)
#define net_ConnectDgram(a, b, c, d, e ) __net_ConnectDgram(VLC_OBJECT(a), b, c, d, e)
VLC_EXPORT
(
int
,
__net_ConnectDgram
,
(
vlc_object_t
*
p_this
,
const
char
*
psz_host
,
int
i_port
,
int
hlim
,
int
proto
)
);
...
...
include/vlc_objects.h
View file @
e516ddb1
...
...
@@ -139,7 +139,7 @@ VLC_EXPORT( void, __vlc_object_wait, ( vlc_object_t * ) );
VLC_EXPORT
(
int
,
__vlc_object_timedwait
,
(
vlc_object_t
*
,
mtime_t
)
);
#define vlc_object_timedwait( obj, d ) \
__vlc_object_timedwait( VLC_OBJECT( obj ),
d
)
__vlc_object_timedwait( VLC_OBJECT( obj ),
check_deadline(d)
)
VLC_EXPORT
(
void
,
__vlc_object_signal_unlocked
,
(
vlc_object_t
*
)
);
#define vlc_object_signal_unlocked( obj ) \
...
...
include/vlc_threads.h
View file @
e516ddb1
...
...
@@ -411,8 +411,8 @@ static inline void __vlc_cond_wait( const char * psz_file, int i_line,
*****************************************************************************
* Returns 0 if object signaled, an error code in case of timeout or error.
*****************************************************************************/
#define vlc_cond_timedwait(
P_COND, P_MUTEX, DEADLINE )
\
__vlc_cond_timedwait( __FILE__, __LINE__,
P_COND, P_MUTEX, DEADLINE
)
#define vlc_cond_timedwait(
c, m, d )
\
__vlc_cond_timedwait( __FILE__, __LINE__,
c, m, check_deadline(d)
)
static
inline
int
__vlc_cond_timedwait
(
const
char
*
psz_file
,
int
i_line
,
vlc_cond_t
*
p_condvar
,
...
...
src/misc/mtime.c
View file @
e516ddb1
...
...
@@ -314,6 +314,7 @@ mtime_t mdate( void )
return
res
;
}
#undef mwait
/**
* Wait for a date
*
...
...
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