[vlc-commits] os2: thread: determine cancelable state with killable variable
KO Myung-Hun
git at videolan.org
Tue Dec 8 10:18:09 CET 2015
vlc/vlc-2.2 | branch: master | KO Myung-Hun <komh78 at gmail.com> | Sun Dec 6 18:57:41 2015 +0900| [ada74145cbe3feb088eb12969932292811b9bfe0] | committer: Jean-Baptiste Kempf
os2: thread: determine cancelable state with killable variable
If thread cancel is disabled and cancel is requested, it causes a tight
infinite loop eating up CPU in cancellation points such as vlc_join(),
vlc_cond_wait() and vlc_cond_timedwait().
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>
(cherry picked from commit 973a465a5a28ebd9c9bcf860f21e2dca85ee1a9e)
Signed-off-by: KO Myung-Hun <komh at chollian.net>
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=ada74145cbe3feb088eb12969932292811b9bfe0
---
src/os2/thread.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/os2/thread.c b/src/os2/thread.c
index be2b94c..f6cf19f 100644
--- a/src/os2/thread.c
+++ b/src/os2/thread.c
@@ -70,7 +70,7 @@ struct vlc_thread
static void vlc_cancel_self (PVOID dummy);
-static ULONG vlc_DosWaitEventSemEx( HEV hev, ULONG ulTimeout, BOOL fCancelable )
+static ULONG vlc_DosWaitEventSemEx( HEV hev, ULONG ulTimeout )
{
HMUX hmux;
SEMRECORD asr[ 2 ];
@@ -79,10 +79,11 @@ static ULONG vlc_DosWaitEventSemEx( HEV hev, ULONG ulTimeout, BOOL fCancelable )
ULONG rc;
struct vlc_thread *th = vlc_threadvar_get( thread_key );
- if( th == NULL || !fCancelable )
+ if( th == NULL || !th->killable )
{
/* Main thread - cannot be cancelled anyway
* Alien thread - out of our control
+ * Cancel disabled thread - ignore cancel
*/
if( hev != NULLHANDLE )
return DosWaitEventSem( hev, ulTimeout );
@@ -118,12 +119,12 @@ static ULONG vlc_DosWaitEventSemEx( HEV hev, ULONG ulTimeout, BOOL fCancelable )
static ULONG vlc_WaitForSingleObject (HEV hev, ULONG ulTimeout)
{
- return vlc_DosWaitEventSemEx( hev, ulTimeout, TRUE );
+ return vlc_DosWaitEventSemEx( hev, ulTimeout );
}
static ULONG vlc_Sleep (ULONG ulTimeout)
{
- ULONG rc = vlc_DosWaitEventSemEx( NULLHANDLE, ulTimeout, TRUE );
+ ULONG rc = vlc_DosWaitEventSemEx( NULLHANDLE, ulTimeout );
return ( rc != ERROR_TIMEOUT ) ? rc : 0;
}
More information about the vlc-commits
mailing list