Skip to content

Commit

Permalink
[core] A workaround for pthread_cancel on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsharabayko committed Aug 25, 2020
1 parent 065fd9c commit 3ad4518
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions srtcore/sync_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,13 @@ srt::sync::CThread& srt::sync::CThread::operator=(CThread& other)
LOGC(mglog.Error, log << "IPE: Assigning to a thread that is not terminated!");

#ifndef DEBUG
#ifndef ANDROID
// In case of production build the hanging thread should be terminated
// to avoid hang ups and align with C++11 implementation.
// There is no pthread_cancel on Android. See #1476. This error should not normally
// happen, but if it happen, then detaching the thread.
pthread_cancel(m_thread);
#endif // ANDROID
#else
join();
#endif
Expand Down

0 comments on commit 3ad4518

Please sign in to comment.