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
b08e6db9
Commit
b08e6db9
authored
Aug 29, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
interrupt: add calls to pass interrupt onto another thread
parent
33655fee
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
0 deletions
+73
-0
include/vlc_interrupt.h
include/vlc_interrupt.h
+36
-0
src/libvlccore.sym
src/libvlccore.sym
+2
-0
src/misc/interrupt.c
src/misc/interrupt.c
+35
-0
No files found.
include/vlc_interrupt.h
View file @
b08e6db9
...
@@ -189,5 +189,41 @@ VLC_API void vlc_interrupt_kill(vlc_interrupt_t *);
...
@@ -189,5 +189,41 @@ VLC_API void vlc_interrupt_kill(vlc_interrupt_t *);
*/
*/
VLC_API
bool
vlc_killed
(
void
)
VLC_USED
;
VLC_API
bool
vlc_killed
(
void
)
VLC_USED
;
/**
* Enables forwarding of interruption.
*
* If an interruption is raised through the context of the calling thread,
* it will be forwarded to the specified other context. This is used to cross
* thread boundaries.
*
* If the calling thread already has an interruption pending, this function
* dequeues the interrupt, return an error code and does not enable forwarding.
*
* If the calling thread has no interrupt context, this function does nothing
* and returns zero.
*
* @param to context to forward to
* @return 0 on success, or EINTR on error
*/
VLC_API
int
vlc_interrupt_forward_start
(
vlc_interrupt_t
*
to
,
void
*
data
[
2
])
VLC_USED
;
/**
* Undoes vlc_interrupt_forward_start().
*
* This function must be called after each succesful call to
* vlc_interrupt_forward_start() before any other interruptible call is made
* in the same thread.
*
* If an interruption was raised against the context of the calling thread
* (after the previous call to vlc_interrupt_forward_start()), it is dequeued.
*
* If the calling thread has no interrupt context, this function does nothing
* and returns zero.
*
* @return 0 if no interrupt was raised, EINTR if an interrupt was raised
*/
VLC_API
int
vlc_interrupt_forward_stop
(
void
*
const
data
[
2
]);
/** @} @} */
/** @} @} */
#endif
#endif
src/libvlccore.sym
View file @
b08e6db9
...
@@ -562,6 +562,8 @@ vlc_interrupt_destroy
...
@@ -562,6 +562,8 @@ vlc_interrupt_destroy
vlc_interrupt_set
vlc_interrupt_set
vlc_interrupt_raise
vlc_interrupt_raise
vlc_interrupt_kill
vlc_interrupt_kill
vlc_interrupt_forward_start
vlc_interrupt_forward_stop
vlc_killed
vlc_killed
vlc_join
vlc_join
vlc_list_children
vlc_list_children
...
...
src/misc/interrupt.c
View file @
b08e6db9
...
@@ -302,6 +302,41 @@ int vlc_mwait_i11e(mtime_t deadline)
...
@@ -302,6 +302,41 @@ int vlc_mwait_i11e(mtime_t deadline)
return
ret
;
return
ret
;
}
}
static
void
vlc_interrupt_forward_wake
(
void
*
opaque
)
{
void
**
data
=
opaque
;
vlc_interrupt_t
*
to
=
data
[
0
];
vlc_interrupt_t
*
from
=
data
[
1
];
(
atomic_load
(
&
from
->
killed
)
?
vlc_interrupt_kill
:
vlc_interrupt_raise
)(
to
);
}
int
vlc_interrupt_forward_start
(
vlc_interrupt_t
*
to
,
void
*
data
[
2
])
{
data
[
0
]
=
data
[
1
]
=
NULL
;
vlc_interrupt_t
*
from
=
vlc_threadvar_get
(
vlc_interrupt_var
);
if
(
from
==
NULL
)
return
0
;
assert
(
from
!=
to
);
data
[
0
]
=
to
;
data
[
1
]
=
from
;
return
vlc_interrupt_prepare
(
from
,
vlc_interrupt_forward_wake
,
data
);
}
int
vlc_interrupt_forward_stop
(
void
*
const
data
[
2
])
{
vlc_interrupt_t
*
from
=
data
[
1
];
if
(
from
==
NULL
)
return
0
;
assert
(
from
->
callback
==
vlc_interrupt_forward_wake
);
assert
(
from
->
data
==
data
);
return
vlc_interrupt_finish
(
from
);
}
#ifndef _WIN32
#ifndef _WIN32
static
void
vlc_poll_i11e_wake
(
void
*
opaque
)
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