Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReentrantSemaphore"/> class.
 /// </summary>
 /// <param name="initialCount">The initial number of concurrent operations to allow.</param>
 /// <param name="joinableTaskContext">The <see cref="JoinableTaskContext"/> to use to mitigate deadlocks.</param>
 /// <devremarks>
 /// This is private protected so that others cannot derive from this type but we can within the assembly.
 /// </devremarks>
 private protected ReentrantSemaphore(int initialCount, JoinableTaskContext joinableTaskContext)
 {
     this.joinableTaskCollection = joinableTaskContext?.CreateCollection();
     this.joinableTaskFactory    = joinableTaskContext?.CreateFactory(this.joinableTaskCollection);
     this.semaphore = new AsyncSemaphore(initialCount);
 }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Releaser"/> struct.
 /// </summary>
 /// <param name="toRelease">The lock instance to release on.</param>
 internal Releaser(AsyncSemaphore toRelease)
 {
     this.toRelease = toRelease;
 }
Exemple #3
0
 internal WaiterInfo(AsyncSemaphore owner, CancellationToken cancellationToken)
 {
     this.Owner             = owner;
     this.CancellationToken = cancellationToken;
 }