Acl. Create(Boolean, String, Boolean, MutexSecurity) Method
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
public: static System::Threading::Mutex ^ Create(bool initiallyOwned, System::String ^ name, [Runtime::InteropServices::Out] bool % createdNew, System::Security::AccessControl::MutexSecurity ^ mutexSecurity);
public static System.Threading.Mutex Create (bool initiallyOwned, string? name, out bool createdNew, System.Security.AccessControl.MutexSecurity? mutexSecurity);
static member Create : bool * string * bool * System.Security.AccessControl.MutexSecurity -> System.Threading.Mutex
Public Shared Function Create (initiallyOwned As Boolean, name As String, ByRef createdNew As Boolean, mutexSecurity As MutexSecurity) As Mutex
true to give the calling thread initial ownership of the named system mutex if the named system mutex is created as a result of this call; otherwise,
The name, if the synchronization object is to be shared with other processes; otherwise,
null or an empty string. The name is case-sensitive.
When this method returns, this argument is always set to
true if a local mutex is created; that is, when
null or Empty. If
name has a valid non-empty value, this argument is set to
true when the system mutex is created, or it is set to
false if an existing system mutex is found with that name. This parameter is passed uninitialized.
The optional mutex access control security to apply.
An object that represents a system mutex, if named, or a local mutex, if nameless.
.NET Framework only:
name is longer than MAX_PATH (260 characters).
name is invalid. This can be for various reasons, including some restrictions that may be placed by the operating system, such as an unknown prefix or invalid characters. Note that the name and common prefixes "Global" and "Local" are case-sensitive.
There was some other error. The
HResult property may provide more information.
name specified an unknown namespace. See Object Names for more information.
name is too long. Length restrictions may depend on the operating system or configuration.
A synchronization object with the provided
name cannot be created. A synchronization object of a different type might have the same name.
name may be prefixed with
Local\ to specify a namespace. When the
Global namespace is specified, the synchronization object may be shared with any processes on the system. When the
Local namespace is specified, which is also the default when no namespace is specified, the synchronization object may be shared with processes in the same session. On Windows, a session is a login session, and services typically run in a different non-interactive session. On Unix-like operating systems, each shell has its own session. Session-local synchronization objects may be appropriate for synchronizing between processes with a parent/child relationship where they all run in the same session. For more information about synchornization object names on Windows, see Object Names.
name is provided and a synchronization object of the requested type already exists in the namespace, the existing synchronization object is opened. If a synchronization object of a different type already exists in the namespace, a
WaitHandleCannotBeOpenedException is thrown. Otherwise, a new synchronization object is created.