Einzelnen Beitrag anzeigen

Benutzerbild von Zacherl

Registriert seit: 3. Sep 2004
4.629 Beiträge
Delphi 10.2 Tokyo Starter

AW: Mutex Synchronisation funktioniert nicht?!

  Alt 13. Jan 2014, 21:30
Setz mal den bInitialOwner Parameter bei CreateMutex auf false, dann geht es

Edit mit Quote aus dem MSDN:
If this value is TRUE and the caller created the mutex, the calling thread obtains initial ownership of the mutex object. Otherwise, the calling thread does not obtain ownership of the mutex. To determine if the caller created the mutex, see the Return Values section.
The thread that owns a mutex can specify the same mutex in repeated wait function calls without blocking its execution. Typically, you would not wait repeatedly for the same mutex, but this mechanism prevents a thread from deadlocking itself while waiting for a mutex that it already owns. However, to release its ownership, the thread must call ReleaseMutex once for each time that the mutex satisfied a wait.

Two or more processes can call CreateMutex to create the same named mutex. The first process actually creates the mutex, and subsequent processes with sufficient access rights simply open a handle to the existing mutex. This enables multiple processes to get handles of the same mutex, while relieving the user of the responsibility of ensuring that the creating process is started first. When using this technique, you should set the bInitialOwner flag to FALSE; otherwise, it can be difficult to be certain which process has initial ownership.
- GitHub (Profil, zyantific)
- zYan Disassembler Engine ( Zydis Online, Zydis GitHub)

Geändert von Zacherl (13. Jan 2014 um 21:33 Uhr)
  Mit Zitat antworten Zitat