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
b0e76ef9
Commit
b0e76ef9
authored
Oct 12, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Android: avoid polling timer in vlc_join()
parent
d611f5c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
src/android/thread.c
src/android/thread.c
+7
-7
No files found.
src/android/thread.c
View file @
b0e76ef9
...
@@ -168,12 +168,12 @@ struct vlc_thread
...
@@ -168,12 +168,12 @@ struct vlc_thread
pthread_t
thread
;
pthread_t
thread
;
pthread_cond_t
*
cond
;
/// Non-null if thread waiting on cond
pthread_cond_t
*
cond
;
/// Non-null if thread waiting on cond
vlc_mutex_t
lock
;
/// Protects cond
vlc_mutex_t
lock
;
/// Protects cond
vlc_sem_t
finished
;
void
*
(
*
entry
)(
void
*
);
void
*
(
*
entry
)(
void
*
);
void
*
data
;
void
*
data
;
vlc_atomic_t
killed
;
vlc_atomic_t
killed
;
vlc_atomic_t
finished
;
bool
killable
;
bool
killable
;
};
};
...
@@ -283,7 +283,7 @@ static void *joinable_thread(void *data)
...
@@ -283,7 +283,7 @@ static void *joinable_thread(void *data)
thread
=
th
;
thread
=
th
;
ret
=
th
->
entry
(
th
->
data
);
ret
=
th
->
entry
(
th
->
data
);
vlc_
atomic_set
(
&
th
->
finished
,
true
);
vlc_
sem_post
(
&
th
->
finished
);
return
ret
;
return
ret
;
}
}
...
@@ -309,8 +309,9 @@ static int vlc_clone_attr (vlc_thread_t *th, void *(*entry) (void *),
...
@@ -309,8 +309,9 @@ static int vlc_clone_attr (vlc_thread_t *th, void *(*entry) (void *),
pthread_sigmask
(
SIG_BLOCK
,
&
set
,
&
oldset
);
pthread_sigmask
(
SIG_BLOCK
,
&
set
,
&
oldset
);
}
}
vlc_sem_init
(
&
thread
->
finished
,
0
);
vlc_atomic_set
(
&
thread
->
killed
,
false
);
vlc_atomic_set
(
&
thread
->
killed
,
false
);
vlc_atomic_set
(
&
thread
->
finished
,
false
);
thread
->
killable
=
true
;
thread
->
killable
=
true
;
thread
->
cond
=
NULL
;
thread
->
cond
=
NULL
;
thread
->
entry
=
entry
;
thread
->
entry
=
entry
;
...
@@ -340,9 +341,8 @@ int vlc_clone (vlc_thread_t *th, void *(*entry) (void *), void *data,
...
@@ -340,9 +341,8 @@ int vlc_clone (vlc_thread_t *th, void *(*entry) (void *), void *data,
void
vlc_join
(
vlc_thread_t
handle
,
void
**
result
)
void
vlc_join
(
vlc_thread_t
handle
,
void
**
result
)
{
{
vlc_testcancel
();
vlc_sem_wait
(
&
handle
->
finished
);
while
(
!
vlc_atomic_get
(
&
handle
->
finished
))
vlc_sem_destroy
(
&
handle
->
finished
);
msleep
(
CLOCK_FREQ
/
100
);
int
val
=
pthread_join
(
handle
->
thread
,
result
);
int
val
=
pthread_join
(
handle
->
thread
,
result
);
VLC_THREAD_ASSERT
(
"joining thread"
);
VLC_THREAD_ASSERT
(
"joining thread"
);
...
@@ -406,7 +406,7 @@ void vlc_testcancel (void)
...
@@ -406,7 +406,7 @@ void vlc_testcancel (void)
if
(
!
vlc_atomic_get
(
&
thread
->
killed
))
if
(
!
vlc_atomic_get
(
&
thread
->
killed
))
return
;
return
;
vlc_
atomic_set
(
&
thread
->
finished
,
true
);
vlc_
sem_post
(
&
thread
->
finished
);
#warning FIXME: memory leak for detached threads
#warning FIXME: memory leak for detached threads
pthread_exit
(
NULL
);
pthread_exit
(
NULL
);
}
}
...
...
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