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
4a9086ff
Commit
4a9086ff
authored
Dec 21, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
interrupt: add internal vlc_interrupt_get() helper
parent
b257a2cf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
10 deletions
+15
-10
src/misc/interrupt.c
src/misc/interrupt.c
+15
-10
No files found.
src/misc/interrupt.c
View file @
4a9086ff
...
...
@@ -150,6 +150,11 @@ vlc_interrupt_t *vlc_interrupt_set(vlc_interrupt_t *newctx)
return
oldctx
;
}
static
vlc_interrupt_t
*
vlc_interrupt_get
(
void
)
{
return
vlc_threadvar_get
(
vlc_interrupt_var
);
}
/**
* Prepares to enter interruptible wait.
* @param cb callback to interrupt the wait (i.e. wake up the thread)
...
...
@@ -161,7 +166,7 @@ static void vlc_interrupt_prepare(vlc_interrupt_t *ctx,
void
(
*
cb
)(
void
*
),
void
*
data
)
{
assert
(
ctx
!=
NULL
);
assert
(
ctx
==
vlc_
threadvar_get
(
vlc_interrupt_var
));
assert
(
ctx
==
vlc_
interrupt_get
(
));
vlc_mutex_lock
(
&
ctx
->
lock
);
assert
(
ctx
->
callback
==
NULL
);
...
...
@@ -189,7 +194,7 @@ static int vlc_interrupt_finish(vlc_interrupt_t *ctx)
int
ret
=
0
;
assert
(
ctx
!=
NULL
);
assert
(
ctx
==
vlc_
threadvar_get
(
vlc_interrupt_var
));
assert
(
ctx
==
vlc_
interrupt_get
(
));
/* Wait for pending callbacks to prevent access by other threads. */
vlc_mutex_lock
(
&
ctx
->
lock
);
...
...
@@ -205,14 +210,14 @@ static int vlc_interrupt_finish(vlc_interrupt_t *ctx)
void
vlc_interrupt_register
(
void
(
*
cb
)(
void
*
),
void
*
opaque
)
{
vlc_interrupt_t
*
ctx
=
vlc_
threadvar_get
(
vlc_interrupt_var
);
vlc_interrupt_t
*
ctx
=
vlc_
interrupt_get
(
);
if
(
ctx
!=
NULL
)
vlc_interrupt_prepare
(
ctx
,
cb
,
opaque
);
}
int
vlc_interrupt_unregister
(
void
)
{
vlc_interrupt_t
*
ctx
=
vlc_
threadvar_get
(
vlc_interrupt_var
);
vlc_interrupt_t
*
ctx
=
vlc_
interrupt_get
(
);
return
(
ctx
!=
NULL
)
?
vlc_interrupt_finish
(
ctx
)
:
0
;
}
...
...
@@ -231,7 +236,7 @@ void vlc_interrupt_kill(vlc_interrupt_t *ctx)
bool
vlc_killed
(
void
)
{
vlc_interrupt_t
*
ctx
=
vlc_
threadvar_get
(
vlc_interrupt_var
);
vlc_interrupt_t
*
ctx
=
vlc_
interrupt_get
(
);
return
(
ctx
!=
NULL
)
&&
atomic_load
(
&
ctx
->
killed
);
}
...
...
@@ -243,7 +248,7 @@ static void vlc_interrupt_sem(void *opaque)
int
vlc_sem_wait_i11e
(
vlc_sem_t
*
sem
)
{
vlc_interrupt_t
*
ctx
=
vlc_
threadvar_get
(
vlc_interrupt_var
);
vlc_interrupt_t
*
ctx
=
vlc_
interrupt_get
(
);
if
(
ctx
==
NULL
)
return
vlc_sem_wait
(
sem
),
0
;
...
...
@@ -273,7 +278,7 @@ static void vlc_mwait_i11e_cleanup(void *opaque)
int
vlc_mwait_i11e
(
mtime_t
deadline
)
{
vlc_interrupt_t
*
ctx
=
vlc_
threadvar_get
(
vlc_interrupt_var
);
vlc_interrupt_t
*
ctx
=
vlc_
interrupt_get
(
);
if
(
ctx
==
NULL
)
return
mwait
(
deadline
),
0
;
...
...
@@ -308,7 +313,7 @@ void 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
);
vlc_interrupt_t
*
from
=
vlc_
interrupt_get
(
);
if
(
from
==
NULL
)
return
;
...
...
@@ -417,7 +422,7 @@ static int vlc_poll_i11e_inner(struct pollfd *restrict fds, unsigned nfds,
int
vlc_poll_i11e
(
struct
pollfd
*
fds
,
unsigned
nfds
,
int
timeout
)
{
vlc_interrupt_t
*
ctx
=
vlc_
threadvar_get
(
vlc_interrupt_var
);
vlc_interrupt_t
*
ctx
=
vlc_
interrupt_get
(
);
if
(
ctx
==
NULL
)
return
poll
(
fds
,
nfds
,
timeout
);
...
...
@@ -614,7 +619,7 @@ static void vlc_poll_i11e_cleanup(void *opaque)
int
vlc_poll_i11e
(
struct
pollfd
*
fds
,
unsigned
nfds
,
int
timeout
)
{
vlc_interrupt_t
*
ctx
=
vlc_
threadvar_get
(
vlc_interrupt_var
);
vlc_interrupt_t
*
ctx
=
vlc_
interrupt_get
(
);
if
(
ctx
==
NULL
)
return
vlc_poll
(
fds
,
nfds
,
timeout
);
...
...
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