Semaphore Constructor (Int32, Int32, String, Boolean)
Collapse the table of content
Expand the table of content

Semaphore Constructor (Int32, Int32, String, Boolean%)

For apps that target Windows Phone OS 7.0 and 7.1, do not use this member in your app. If you do, your code will throw a MethodAccessException. This member is security-critical, which restricts it to internal use by the .NET Framework for Windows Phone class library.

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Initializes a new instance of the Semaphore class, specifying the maximum number of concurrent entries, optionally reserving some entries for the calling thread, optionally specifying the name of a system semaphore object, and specifying a variable that receives a value indicating whether a new system semaphore was created.

Namespace:  System.Threading
Assembly:  System (in System.dll)

public Semaphore(
	int initialCount,
	int maximumCount,
	string name,
	out bool createdNew


Type: System.Int32
The initial number of requests for the semaphore that can be satisfied concurrently.
Type: System.Int32
The maximum number of requests for the semaphore that can be satisfied concurrently.
Type: System.String
The name of a named system semaphore object.
Type: System.Boolean %
When this method returns, contains true if a local semaphore was created (that is, if name is null or an empty string) or if the specified named system semaphore was created; false if the specified named system semaphore already existed. This parameter is passed uninitialized.

Windows Phone OS

Supported in: 8.1, 8.0

© 2016 Microsoft