CreateMutex function (rpm)

CreateMutex function 
this function to find examples of the current system already exists for the specified process. If you do not create a mutex.

CreateMutex () function can be used to create a named or unnamed mutex object whose function prototype is: 
HANDLE CreateMutex ( 
LPSECURITY_ATTRIBUTESlpMutexAttributes, // pointer to point to the security attributes BOOLbInitialOwner, // initialize the mutex owner LPCTSTRlpName // point to each other repellent pointer object name); 
parameter Description types 
lpMutexAttributes SECURITY_ATTRIBUTES, SECURITY_ATTRIBUTES a specified structure, or pass a zero value (the parameter is declared as ByVal as Long, and passes the zero value), the default indication inherited allowed descriptor 
bInitialOwner Long, as the process of creating wish it could have a mutex is set to TRUE. While only a mutex is owned by a thread 
lpName String, specify the name mutex object. Create an unnamed mutex object with vbNullString. An event such as this has a name already exists, open an existing named mutex. The name may not be an existing event, signal, wait for a timer or file-mapping consistent 
return value Long, such as the implementation of successful, it returns the mutex object handle; zero indicates an error. Sets GetLastError even if the return is a valid handle, but if specified name already exists, GetLastError will set ERROR_ALREADY_EXISTS Note: 
when you no longer need, attention must CloseHandle function to close the mutex handle. Subordinate to it after all handles are closed, it will delete the object 
Before the process aborted, be sure to release the mutex, if they did not take this measure, the mutex will be marked as obsolete and automatically release ownership. Share this other application mutex might still be able to use it, but will receive an abandoned state message indicating a failure to properly shut down all processes. Whether this situation will be affected depending on the specific application involved
----------------
Disclaimer: This article is the original article CSDN bloggers "Shu Yi drizzly night love", and follow CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/chenzhen1213/article/details/43272905

Guess you like

Origin www.cnblogs.com/Stephen-Qin/p/11970227.html
rpm