This is the mail archive of the mailing list for the pthreas-win32 project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Pthreads-win32 and static linking


The Mingw-cross-env project provides a MinGW cross-compiling environment
for POSIX systems. For various reasons, all included libraries are
static, including the pthreads-win32 library.

This means that all pthreads users need to call
pthread_win32_thread_attach_np() and pthread_win32_thread_detach_np() in
each thread function.

We would like to avoid patching all libraries that use pthread, and
instead change pthreads-win32: instead of using a thread main function
given to pthread_create() directly, pthreads-win32 could use an internal
wrapper that calls the thread main function and also calls the
attach/detach functions if necessary.

To avoid the pthread_win32_process_attach() function, pthreads-win32
could check on each function call whether the library was initialized,
and if not, call pthread_win32_process_attach() itself.

This would induce some overhead, but would allow us to use a large
number of existing libraries unchanged.

Before we start to work on a patch, we would like to know if this
approach has a chance to work. Do you know any technical reasons why
this might fail?

Best regards,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]