Replies: 2 comments 19 replies
-
CreateMutex on a named mutex that already exists, returns a handle to the existing mutex. Can you provide a sample where you proved that this didn't happen? (I.e. proves Microsoft's documentation about mutex behavior to be wrong.) Otherwise you're simply wasting effort with this.
Named mutexes cannot deadlock other mutexes, only themselves (i.e. the mutex with that unique name).
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Ralph Engels ***@***.***>
Sent: Friday, October 7, 2022 6:50:57 AM
To: jmeubank/tdm-gcc ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [jmeubank/tdm-gcc] bughunting weirdness and other stuff (Discussion #60)
New version is quite ingenious but there were a few things that needed checking.
mutex locks opening the same mutex in two places with CreateMutex is a recipee for disaster because the second lock would get ERROR_ALLREADY_EXIST and wont be given permission to lock the cleanup function. So use OpenMutex to check if the lock is still active
and if that is the case use that else recreate it with CreateMutex.
Sadly there are more examples of things that break with the mutex locking mechanism, for one glib2 started using mutex locks as well and the version they use deadlocks the TDM mutex causing more or less the same exception to be thrown as the example above.
Took me quite a while but here is a version of the shmem mechanism that is pretty reliable ->
0160-shared-memory.zip<https://github.com/jmeubank/tdm-gcc/files/9734423/0160-shared-memory.zip>
it still borks at the glib2 mutex at times so i made an extra flag to be used in CFLAGS / CXXFLAGS -> _USE_SHMEM to turn the shared pointer code on or off in your project, downside is that anything compiled without setting -D_USE_SHMEM=1 will not be able to throw exceptions across dll boundaries but normal exceptions still work. This is a workaround untill we can figure out a way to get protect the mutex functions from being tampered with by external sources.
—
Reply to this email directly, view it on GitHub<#60>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AKSVUFGAFKBY4PEFZFOPKA3WCATEDANCNFSM6AAAAAAQ7TUVZA>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
16 replies
-
Debug build of gcc-10.4.0 with the TDM patchset uploaded here -> https://sourceforge.net/projects/cbadvanced/files/TDM%20Debug/ built with -ggdb3 to get as much debug info as possible, changed the if before WaitForSIngleObject to while, all static dependencies used. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
New version is quite ingenious but there were a few things that needed checking.
mutex locks opening the same mutex in two places with CreateMutex is a recipee for disaster because the second lock would get ERROR_ALLREADY_EXIST and wont be given permission to lock the cleanup function. So use OpenMutex to check if the lock is still active
and if that is the case use that else recreate it with CreateMutex.
Sadly there are more examples of things that break with the mutex locking mechanism, for one glib2 started using mutex locks as well and the version they use deadlocks the TDM mutex causing more or less the same exception to be thrown as the example above.
Took me quite a while but here is a version of the shmem mechanism that is pretty reliable ->
0160-shared-memory.zip
it still borks at the glib2 mutex at times so i made an extra flag to be used in CFLAGS / CXXFLAGS -> _USE_SHMEM to turn the shared pointer code on or off in your project, downside is that anything compiled without setting -D_USE_SHMEM=1 will not be able to throw exceptions across dll boundaries but normal exceptions still work. This is a workaround untill we can figure out a way to protect the mutex functions from being tampered with by external sources.
Beta Was this translation helpful? Give feedback.
All reactions