[vlc-commits] [Git][videolan/vlc][master] thread: ensure normal thread running doesn't return VLC_THREAD_CANCELED
Rémi Denis-Courmont (@Courmisch)
gitlab at videolan.org
Sat Oct 30 06:42:26 UTC 2021
Rémi Denis-Courmont pushed to branch master at VideoLAN / VLC
Commits:
e514ff3d by Steve Lhomme at 2021-10-30T06:28:46+00:00
thread: ensure normal thread running doesn't return VLC_THREAD_CANCELED
This would make the detection of a canceled thread vs normal run impossible.
Not implemented in posix/thread.c because we don't get the return code in our
code. We could do it with an indirect call.
- - - - -
3 changed files:
- src/android/thread.c
- src/os2/thread.c
- src/win32/thread.c
Changes:
=====================================
src/android/thread.c
=====================================
@@ -93,7 +93,9 @@ static void *joinable_thread(void *data)
vlc_thread_t th = data;
thread = th;
- return th->entry(th->data);
+ void *result = th->entry(th->data);
+ assert(result != VLC_THREAD_CANCELED); // don't hijack our internal values
+ return result;
}
static int vlc_clone_attr (vlc_thread_t *th, void *(*entry) (void *),
=====================================
src/os2/thread.c
=====================================
@@ -439,6 +439,7 @@ static void vlc_entry( void *p )
current_thread_ctx = th;
th->killable = true;
th->data = th->entry (th->data);
+ assert(th->data != VLC_THREAD_CANCELED); // don't hijack our internal values
DosPostEventSem( th->done_event );
vlc_thread_cleanup (th);
}
=====================================
src/win32/thread.c
=====================================
@@ -346,6 +346,7 @@ __stdcall vlc_entry (void *p)
current_thread_ctx = th;
th->killable = true;
th->data = th->entry (th->data);
+ assert(th->data != VLC_THREAD_CANCELED); // don't hijack our internal values
current_thread_ctx = NULL;
return 0;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/e514ff3d10ce22049813b672bdfc0e39bd378492
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/e514ff3d10ce22049813b672bdfc0e39bd378492
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list