[PATCH i-g-t v6 07/14] lib/igt_dummyload: Avoid pthread_cancel use by overriding timer value
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Mon May 19 06:57:04 UTC 2025
On Fri, May 16, 2025 at 04:05:44PM +0000, Jeevaka Prabu Badrappan wrote:
> Android build fails due to pthread_cancel unavailability.
> Replace pthread_cancel by overriding the expiration time of the timer.
>
> Signed-off-by: Jeevaka Prabu Badrappan <jeevaka.badrappan at intel.com>
> ---
> lib/igt_dummyload.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
> index 3cf80b762..cc0b4ac3b 100644
> --- a/lib/igt_dummyload.c
> +++ b/lib/igt_dummyload.c
> @@ -631,7 +631,16 @@ void igt_spin_end(igt_spin_t *spin)
> static void __igt_spin_free(int fd, igt_spin_t *spin)
> {
> if (spin->timerfd >= 0) {
> +#ifdef ANDROID
> + struct itimerspec its;
> +
> + memset(&its, 0, sizeof(its));
> + its.it_value.tv_sec = 0;
> + its.it_value.tv_nsec = 1;
> + timerfd_settime(spin->timerfd, 0, &its, NULL);
> +#else
Looks good to me. I haven't tested this on Android, but should work
similar to Linux:
Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
--
Zbigniew
> pthread_cancel(spin->timer_thread);
> +#endif
> igt_assert(pthread_join(spin->timer_thread, NULL) == 0);
> close(spin->timerfd);
> }
> --
> 2.49.0
>
More information about the igt-dev
mailing list