mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-08 04:20:09 +00:00
More string tidying-up. Possible fix for win32 mutexes failing under strange circumstances.
This commit is contained in:
parent
ef36a42ee6
commit
04351861ae
18 changed files with 357 additions and 533 deletions
|
|
@ -348,8 +348,14 @@ public:
|
|||
Pimpl (String name, const int timeOutMillisecs)
|
||||
: handle (0), refCount (1)
|
||||
{
|
||||
name = "Local\\" + name.replaceCharacter ('\\', '/');
|
||||
handle = CreateMutexW (0, TRUE, name.toUTF16().getAddress());
|
||||
name = name.replaceCharacter ('\\', '/');
|
||||
handle = CreateMutexW (0, TRUE, ("Global\\" + name).toUTF16().getAddress());
|
||||
|
||||
// Not 100% sure why a global mutex sometimes can't be allocated, but if it fails, fall back to
|
||||
// a local one. (A local one also sometimes fails on other machines so neither type appears to be
|
||||
// universally reliable)
|
||||
if (handle == 0)
|
||||
handle = CreateMutexW (0, TRUE, ("Local\\" + name).toUTF16().getAddress());
|
||||
|
||||
if (handle != 0 && GetLastError() == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue