[PATCH i-g-t v8 08/14] lib/xe/xe_spin: Avoid pthread_cancel use by introducing an exit flag
Jeevaka Prabu Badrappan
jeevaka.badrappan at intel.com
Fri May 16 18:26:58 UTC 2025
Android build fails due to pthread_cancel unavailability.
Replace pthread_cancel with thread exit based on an exit flag.
Signed-off-by: Jeevaka Prabu Badrappan <jeevaka.badrappan at intel.com>
---
lib/xe/xe_spin.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/lib/xe/xe_spin.c b/lib/xe/xe_spin.c
index a92903b6b..23f1dfbfd 100644
--- a/lib/xe/xe_spin.c
+++ b/lib/xe/xe_spin.c
@@ -7,6 +7,7 @@
*/
#include <string.h>
+#include <sys/timerfd.h>
#include "drmtest.h"
#include "igt.h"
@@ -264,7 +265,16 @@ void xe_spin_free(int fd, struct igt_spin *spin)
igt_assert(spin->driver == INTEL_DRIVER_XE);
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
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