mingw-cross-env-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Mingw-cross-env-list] Solving the Pthreads issue


From: Tony Theodore
Subject: Re: [Mingw-cross-env-list] Solving the Pthreads issue
Date: Tue, 11 May 2010 15:44:28 +1000

On 11 May 2010 14:21, Martin Lambers <address@hidden> wrote:

> I wrote to both Ross Johnson and the mailing list, and already got a
> response from the mailing list. This situation has apparantly already be
> solved, and in a better way than what I suggested.
>
> Pthreads-win32 uses DLL hooks to automatically execute the attach/detach
> functions. When using static libraries, DLL hooks are not available, so
> the attach/detach functions have to be called manually.
>
> But there is a feature of the PE executable file format used by Windows
> to define hooks also in the case of static linking. Ramiro Polla sent a
> patch that uses this approach. See
> <http://sourceware.org/ml/pthreads-win32/2010/msg00006.html>.
>
> If we're lucky, this already solves the problem. Can someone test this?
>
> One problem might be that libraries which already call attach/detach
> might run into problems, so we might need to be careful about the
> PTW32_STATIC_LIB flag being defined in the header files.

The patch allows the build to succeed, but the test-libgomp.exe
returns somewhat odd results.

Running in linux:
Hello from thread 0, nthreads 2
Hello from thread 1, nthreads 2

Running with wine:
Hello from thread 1, nthreads 2
Hello from thread 1, nthreads 2
Hello from thread 0, nthreads 2

and sometimes

Hello from thread 0, nthreads 2
Hello from thread 0, nthreads 2
Hello from thread 1, nthreads 2

It seems to be much the same if PTW32_STATIC_LIB is defined in the
headers or not.

I've attached the cvs and autostatic patches.

Tony

Attachment: pthreads-1-cvs-20100305.patch
Description: Text Data

Attachment: pthreads-2-autostatic.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]