Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
8b37adbf
Commit
8b37adbf
authored
Sep 15, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vlc_cond_timedwait: wrapper around pthread_cond_timedwait
parent
0787d354
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
1 deletion
+54
-1
include/vlc_threads_funcs.h
include/vlc_threads_funcs.h
+54
-1
No files found.
include/vlc_threads_funcs.h
View file @
8b37adbf
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* vlc_threads_funcs.h : threads implementation for the VideoLAN client
* vlc_threads_funcs.h : threads implementation for the VideoLAN client
* This header provides a portable threads implementation.
* This header provides a portable threads implementation.
*****************************************************************************
*****************************************************************************
* Copyright (C) 1999
, 2002
the VideoLAN team
* Copyright (C) 1999
-2007
the VideoLAN team
* $Id$
* $Id$
*
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
...
@@ -548,6 +548,59 @@ static inline int __vlc_cond_wait( const char * psz_file, int i_line,
...
@@ -548,6 +548,59 @@ static inline int __vlc_cond_wait( const char * psz_file, int i_line,
return
i_result
;
return
i_result
;
}
}
/*****************************************************************************
* vlc_cond_timedwait: wait until condition completion or expiration
*****************************************************************************/
#define vlc_cond_timedwait( P_COND, P_MUTEX, DEADLINE ) \
__vlc_cond_timedwait( __FILE__, __LINE__, P_COND, P_MUTEX, DEADLINE )
static
inline
int
__vlc_cond_timedwait
(
const
char
*
psz_file
,
int
i_line
,
vlc_cond_t
*
p_condvar
,
vlc_mutex_t
*
p_mutex
,
mtime_t
deadline
)
{
int
i_res
;
unsigned
long
int
i_thread
=
0
;
const
char
*
psz_error
=
""
;
#if defined( PTH_INIT_IN_PTH_H )
# error Unimplemented
#elif defined( ST_INIT_IN_ST_H )
# error Unimplemented
#elif defined( UNDER_CE )
# error Unimplemented
#elif defined( WIN32 )
# error Unimplemented FIXME FIXME
#elif defined( HAVE_KERNEL_SCHEDULER_H )
# error Unimplemented
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
lldiv_t
d
=
lldiv
(
deadline
,
1000000
);
struct
timespec
ts
=
{
d
.
quot
,
d
.
rem
*
1000
};
i_res
=
pthread_cond_timedwait
(
&
p_condvar
->
cond
,
&
p_mutex
->
mutex
,
&
ts
);
if
(
i_res
)
{
i_thread
=
CAST_PTHREAD_TO_INT
(
pthread_self
());
psz_error
=
strerror
(
i_res
);
}
#elif defined( HAVE_CTHREADS_H )
# error Unimplemented
#endif
if
(
i_res
)
{
msg_Err
(
p_condvar
->
p_this
,
"thread %li: cond_wait failed at %s:%d (%d:%s)"
,
i_thread
,
psz_file
,
i_line
,
i_res
,
psz_error
);
}
return
i_res
;
}
/*****************************************************************************
/*****************************************************************************
* vlc_cond_destroy: destroy a condition
* vlc_cond_destroy: destroy a condition
*****************************************************************************/
*****************************************************************************/
...
...
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