A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-March/109038.html below:

[Python-Dev] Bugs in thread_nt.h

[Python-Dev] Bugs in thread_nt.h [Python-Dev] Bugs in thread_nt.hSturla Molden sturla at molden.no
Thu Mar 10 02:25:08 CET 2011
Atomic operations (InterlockedCompareExchange, et al.) are used on the 
field 'owned' in NRMUTEX. These methods require the memory to be aligned 
on 32-byte boundaries. They also require the volatile qualifer. Three 
small changes are therefore needed (see below).


Regards,
Sturla Molden





typedef struct NRMUTEX {
     volatile LONG   owned ;  /* Bugfix: remember volatile */
     DWORD  thread_id ;
     HANDLE hevent ;
} NRMUTEX, *PNRMUTEX;


NRMUTEX
AllocNonRecursiveMutex(void)
{
     PNRMUTEX mutex = (PNRMUTEX)_aligned_malloc(sizeof(NRMUTEX),32) ; /* 
Bugfix: align to 32-bytes */
     if (mutex && !InitializeNonRecursiveMutex(mutex))
     {
         free(mutex) ;
         mutex = NULL ;
     }
     return mutex ;
}

void
FreeNonRecursiveMutex(PNRMUTEX mutex)
{
     if (mutex)
     {
         DeleteNonRecursiveMutex(mutex) ;
         _aligned_free(mutex) ; /* Bugfix: align to 32-bytes */
     }
}







More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4