Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#8

AW: Mutex zwischen 2 Prozessen

  Alt 2. Nov 2018, 12:41
Bitte benutze den Debugger und schaue dir an, was das CreateMutex zurückgibt. Es ist ein neues Handle. Zumindest ist das bei mir so.
Zitat:
If the mutex is a named mutex and the object existed before this function call, the return value is a handle to the existing object, GetLastError returns ERROR_ALREADY_EXISTS, bInitialOwner is ignored, and the calling thread is not granted ownership. However, if the caller has limited access rights, the function will fail with ERROR_ACCESS_DENIED and the caller should use the OpenMutex function.
Das Handle ist ein neues, aber das dahinterliegende Mutex ist immer noch das selbe.
1 Mutex - mehrere Handles zu diesem Mutex.

Interessant ist in diesem Fall wahrscheinlich, dass GetLastError ERROR_ALREADY_EXISTS zurückgibt, falls das Mutex schon existiert hat und kein neues erstellt wurde.
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."

Geändert von Neutral General ( 2. Nov 2018 um 12:43 Uhr)
  Mit Zitat antworten Zitat