Thin wrapper reporting failure, in the spirit of xpthread_create() and
xpthread_join().

Signed-off-by: Michal Luczaj <[email protected]>
---
 tools/testing/selftests/bpf/prog_tests/sockmap_helpers.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_helpers.h 
b/tools/testing/selftests/bpf/prog_tests/sockmap_helpers.h
index d815efac52fd..209f2e4fb627 100644
--- a/tools/testing/selftests/bpf/prog_tests/sockmap_helpers.h
+++ b/tools/testing/selftests/bpf/prog_tests/sockmap_helpers.h
@@ -60,6 +60,15 @@
                __ret;                                                         \
        })
 
+#define xpthread_cancel(thread)                                                
\
+       ({                                                                     \
+               int __ret = pthread_cancel((thread));                          \
+               errno = __ret;                                                 \
+               if (__ret)                                                     \
+                       FAIL_ERRNO("pthread_cancel");                          \
+               __ret;                                                         \
+       })
+
 #define xpthread_join(thread, retval)                                          
\
        ({                                                                     \
                int __ret = pthread_join((thread), (retval));                  \

-- 
2.52.0


Reply via email to