* Requires pthread_attr_getstack and pthread_attr_setstack in winpthreads for libwally-core[1] project. * Steps to build and test: Requires clang for test_clear in this project.
cd libwally-core ./tools/autogen.sh mkdir bin; cd bin export CC=clang export CXX=clang++ ../configure --disable-shared make; make check * Attached a patch which I tried but the test_clear fails :( [1]: https://github.com/ElementsProject/libwally-core.git
From 77afc84ce427939925f651bfb2569b34c9c1c394 Mon Sep 17 00:00:00 2001 From: Biswapriyo Nath <nathbap...@gmail.com> Date: Mon, 12 Oct 2020 21:25:17 +0530 Subject: [PATCH] winpthreads: Add pthread_attr_getstack and pthread_attr_setstack. Signed-off-by: Biswapriyo Nath <nathbap...@gmail.com> --- .../winpthreads/include/pthread.h | 2 ++ mingw-w64-libraries/winpthreads/src/thread.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/mingw-w64-libraries/winpthreads/include/pthread.h b/mingw-w64-libraries/winpthreads/include/pthread.h index 4c2affd..15c15c6 100644 --- a/mingw-w64-libraries/winpthreads/include/pthread.h +++ b/mingw-w64-libraries/winpthreads/include/pthread.h @@ -362,6 +362,8 @@ int WINPTHREAD_API pthread_attr_setinheritsched(pthread_attr_t *a, int flag); int WINPTHREAD_API pthread_attr_getinheritsched(const pthread_attr_t *a, int *flag); int WINPTHREAD_API pthread_attr_setscope(pthread_attr_t *a, int flag); int WINPTHREAD_API pthread_attr_getscope(const pthread_attr_t *a, int *flag); +int WINPTHREAD_API pthread_attr_getstack(const pthread_attr_t *attr, void **stack, size_t *size); +int WINPTHREAD_API pthread_attr_setstack(pthread_attr_t *attr, void *stack, size_t size); int WINPTHREAD_API pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stack); int WINPTHREAD_API pthread_attr_setstackaddr(pthread_attr_t *attr, void *stack); int WINPTHREAD_API pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *size); diff --git a/mingw-w64-libraries/winpthreads/src/thread.c b/mingw-w64-libraries/winpthreads/src/thread.c index a9f286b..55361ae 100644 --- a/mingw-w64-libraries/winpthreads/src/thread.c +++ b/mingw-w64-libraries/winpthreads/src/thread.c @@ -1394,6 +1394,22 @@ pthread_attr_getscope (const pthread_attr_t *a, int *flag) return 0; } +int +pthread_attr_getstack (const pthread_attr_t *attr, void **stack, size_t *size) +{ + *stack = (char *) attr->stack - attr->s_size; + *size = attr->s_size; + return 0; +} + +int +pthread_attr_setstack (pthread_attr_t *attr, void *stack, size_t size) +{ + attr->s_size = size; + attr->stack = (char *) stack + size; + return 0; +} + int pthread_attr_getstackaddr (const pthread_attr_t *attr, void **stack) { -- 2.28.0
_______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public