Skip to content

Commit

Permalink
on stock android, pthread_cancel and phtread_setcancelstate doesn't e…
Browse files Browse the repository at this point in the history
…xist

Change-Id: Icbe281a301004ae2bcda4821a50fb4a41088e85d
  • Loading branch information
Flemmard authored and Gerrit Code Review committed Jun 30, 2014
1 parent 4e2ec81 commit 60bf94e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fuse/fuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -4579,7 +4579,11 @@ void fuse_stop_cleanup_thread(struct fuse *f)
{
if (lru_enabled(f)) {
pthread_mutex_lock(&f->lock);
#ifndef ANDROID
pthread_cancel(f->prune_thread);
#else
pthread_kill(f->prune_thread, SIGUSR1);
#endif
pthread_mutex_unlock(&f->lock);
pthread_join(f->prune_thread, NULL);
}
Expand Down
9 changes: 9 additions & 0 deletions fuse/fuse_loop_mt.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,13 @@ static void *fuse_do_work(void *data)
};
int res;

#ifndef ANDROID
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
#endif
res = fuse_session_receive_buf(mt->se, &fbuf, &ch);
#ifndef ANDROID
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
#endif
if (res == -EINTR)
continue;
if (res <= 0) {
Expand Down Expand Up @@ -245,8 +249,13 @@ int fuse_session_loop_mt(struct fuse_session *se)
while (!fuse_session_exited(se))
sem_wait(&mt.finish);

#ifndef ANDROID
for (w = mt.main.next; w != &mt.main; w = w->next)
pthread_cancel(w->thread_id);
#else
for (w = mt.main.next; w != &mt.main; w = w->next)
pthread_kill(w->thread_id, SIGUSR1);
#endif
mt.exit = 1;

while (mt.main.next != &mt.main)
Expand Down

0 comments on commit 60bf94e

Please sign in to comment.