This is the mail archive of the
pthreads-win32@sourceware.org
mailing list for the pthreas-win32 project.
Still fighting 64-bit
- From: Yuri Sadykov <sadykov at gmail dot com>
- To: pthreads-win32 at sourceware dot org
- Date: Fri, 25 Feb 2011 16:37:27 -0500
- Subject: Still fighting 64-bit
Guys,
I still unclear of 64-bit support of current pthread inmlementation on Windows.
I use Visual Studio 2008 to produce native 64-bit executable.
I got pthread sources from top of cvs repository and build the
library. I read somewhere that static lib is not good for some
reasons, so I build DLL. But I have problem with
pthread_cond_destroy(), program crashes on that call.
pthread_cond_destroy() calls pthread_mutex_trylock(), which tries to
call by zero pointer. ptw32_interlocked_compare_exchange should point
to actual function but it is NULL pointer.
if (0 == (LONG) PTW32_INTERLOCKED_COMPARE_EXCHANGE (
(PTW32_INTERLOCKED_LPLONG) &mx->lock_idx,
(PTW32_INTERLOCKED_LONG) 1,
(PTW32_INTERLOCKED_LONG) 0))
Any thoughts? Did I miss some important build steps, like special
defines or something, or maybe there are patches to current CVS trunk?
Best,
--Yuri
/*
* We do a quick check to see if we need to do more work
* to initialise a static mutex. We check
* again inside the guarded section of ptw32_mutex_check_need_init()
* to avoid race conditions.
*/
if (*mutex >= PTHREAD_ERRORCHECK_MUTEX_INITIALIZER)
0000000180006432 mov rax,qword ptr [mutex]
000000018000643A cmp qword ptr [rax],0FFFFFFFFFFFFFFFDh
000000018000643E jb pthread_mutex_trylock+61h (180006461h)
{
if ((result = ptw32_mutex_check_need_init (mutex)) != 0)
0000000180006440 mov rcx,qword ptr [mutex]
0000000180006448 call @ILT+440(ptw32_mutex_check_need_init)
(1800011BDh)
000000018000644D mov dword ptr [result],eax
0000000180006451 cmp dword ptr [result],0
0000000180006456 je pthread_mutex_trylock+61h (180006461h)
{
return (result);
0000000180006458 mov eax,dword ptr [result]
000000018000645C jmp pthread_mutex_trylock+13Ch (18000653Ch)
}
}
mx = *mutex;
0000000180006461 mov rax,qword ptr [mutex]
0000000180006469 mov rax,qword ptr [rax]
000000018000646C mov qword ptr [mx],rax
if (0 == (LONG) PTW32_INTERLOCKED_COMPARE_EXCHANGE (
(PTW32_INTERLOCKED_LPLONG) &mx->lock_idx,
(PTW32_INTERLOCKED_LONG) 1,
(PTW32_INTERLOCKED_LONG) 0))
0000000180006471 xor r8d,r8d
0000000180006474 mov edx,1
0000000180006479 mov rcx,qword ptr [mx]
000000018000647E call qword ptr
[ptw32_interlocked_compare_exchange (180016240h)]
0000000180006484 test eax,eax
0000000180006486 jne pthread_mutex_trylock+0CFh (1800064CFh)
{
if (mx->kind != PTHREAD_MUTEX_NORMAL)
0000000180006488 mov rax,qword ptr [mx]
000000018000648D cmp dword ptr [rax+8],0
0000000180006491 je pthread_mutex_trylock+0CDh (1800064CDh)
{
mx->recursive_count = 1;