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
2ca95bb1
Commit
2ca95bb1
authored
Jul 06, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
interrupt: add vlc_mwait_i11e() and vlc_msleep_i11e()
parent
575a1925
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
0 deletions
+72
-0
include/vlc_interrupt.h
include/vlc_interrupt.h
+27
-0
src/libvlccore.sym
src/libvlccore.sym
+1
-0
src/misc/interrupt.c
src/misc/interrupt.c
+44
-0
No files found.
include/vlc_interrupt.h
View file @
2ca95bb1
...
...
@@ -62,6 +62,33 @@ struct msghdr;
*/
VLC_API
int
vlc_sem_wait_i11e
(
vlc_sem_t
*
);
/**
* Interruptible variant of mwait().
*
* Waits for a specified timestamp or, if the calling thread has an
* interruption context, an interruption.
*
* @return EINTR if an interruption occurred, otherwise 0 once the timestamp is
* reached.
*/
VLC_API
int
vlc_mwait_i11e
(
mtime_t
);
/**
* Interruptible variant of msleep().
*
* Waits for a specified timeout duration or, if the calling thread has an
* interruption context, an interruption.
*
* @param delay timeout value (in microseconds)
*
* @return EINTR if an interruption occurred, otherwise 0 once the timeout
* expired.
*/
static
inline
int
vlc_msleep_i11e
(
mtime_t
delay
)
{
return
vlc_mwait_i11e
(
mdate
()
+
delay
);
}
/**
* Interruptible variant of poll().
*
...
...
src/libvlccore.sym
View file @
2ca95bb1
...
...
@@ -550,6 +550,7 @@ vlc_sendmsg_i11e
vlc_sendto_i11e
vlc_accept_i11e
vlc_sem_wait_i11e
vlc_mwait_i11e
vlc_interrupt_create
vlc_interrupt_destroy
vlc_interrupt_set
...
...
src/misc/interrupt.c
View file @
2ca95bb1
...
...
@@ -258,6 +258,50 @@ int vlc_sem_wait_i11e(vlc_sem_t *sem)
return
vlc_interrupt_finish
(
ctx
);
}
static
void
vlc_mwait_i11e_wake
(
void
*
opaque
)
{
vlc_cond_signal
(
opaque
);
}
static
void
vlc_mwait_i11e_cleanup
(
void
*
opaque
)
{
vlc_interrupt_t
*
ctx
=
opaque
;
vlc_cond_t
*
cond
=
ctx
->
data
;
vlc_mutex_unlock
(
&
ctx
->
lock
);
vlc_interrupt_finish
(
ctx
);
vlc_cond_destroy
(
cond
);
}
int
vlc_mwait_i11e
(
mtime_t
deadline
)
{
vlc_interrupt_t
*
ctx
=
vlc_threadvar_get
(
vlc_interrupt_var
);
if
(
ctx
==
NULL
)
return
mwait
(
deadline
),
0
;
vlc_cond_t
wait
;
vlc_cond_init
(
&
wait
);
int
ret
=
vlc_interrupt_prepare
(
ctx
,
vlc_mwait_i11e_wake
,
&
wait
);
if
(
ret
)
{
vlc_cond_destroy
(
&
wait
);
vlc_testcancel
();
return
ret
;
}
vlc_mutex_lock
(
&
ctx
->
lock
);
vlc_cleanup_push
(
vlc_mwait_i11e_cleanup
,
ctx
);
while
(
!
ctx
->
interrupted
&&
vlc_cond_timedwait
(
&
wait
,
&
ctx
->
lock
,
deadline
)
==
0
);
vlc_cleanup_pop
();
vlc_mutex_unlock
(
&
ctx
->
lock
);
ret
=
vlc_interrupt_finish
(
ctx
);
vlc_cond_destroy
(
&
wait
);
return
ret
;
}
#ifndef _WIN32
static
void
vlc_poll_i11e_wake
(
void
*
opaque
)
{
...
...
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