Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style fixes for CimAsyncOperations #9945

Merged
merged 2 commits into from Jun 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -6,9 +6,9 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Globalization;
using System.Management.Automation;
using System.Threading;
using System.Globalization;

#endregion

Expand Down Expand Up @@ -81,14 +81,14 @@ protected void NewCmdletActionHandler(object cimSession, CmdletActionEventArgs a
/// </para>
/// </summary>
/// <param name="cimSession">
/// <seealso cref="CimSession"/> object raised the event
/// <seealso cref="CimSession"/> object raised the event.
/// </param>
/// <param name="actionArgs">Event argument.</param>
protected void OperationCreatedHandler(object cimSession, OperationEventArgs actionArgs)
{
DebugHelper.WriteLogEx();

lock (this.myLock)
lock (this.a_lock)
{
this.operationCount++;
}
Expand All @@ -101,14 +101,14 @@ protected void OperationCreatedHandler(object cimSession, OperationEventArgs act
/// </para>
/// </summary>
/// <param name="cimSession">
/// <seealso cref="CimSession"/> object raised the event
/// <seealso cref="CimSession"/> object raised the event.
/// </param>
/// <param name="actionArgs">Event argument.</param>
protected void OperationDeletedHandler(object cimSession, OperationEventArgs actionArgs)
{
DebugHelper.WriteLogEx();

lock (this.myLock)
lock (this.a_lock)
{
this.operationCount--;
if (this.operationCount == 0)
Expand All @@ -126,7 +126,7 @@ protected void OperationDeletedHandler(object cimSession, OperationEventArgs act
/// </para>
/// </summary>
/// <param name="cmdletOperation">
/// wrapper of cmdlet, <seealso cref="CmdletOperationBase"/> for details
/// wrapper of cmdlet, <seealso cref="CmdletOperationBase"/> for details.
/// </param>
public void ProcessActions(CmdletOperationBase cmdletOperation)
{
Expand All @@ -147,11 +147,11 @@ public void ProcessActions(CmdletOperationBase cmdletOperation)
/// <summary>
/// <para>
/// process remaining actions until all operations are completed or
/// current cmdlet is terminated by user
/// current cmdlet is terminated by user.
/// </para>
/// </summary>
/// <param name="cmdletOperation">
/// wrapper of cmdlet, <seealso cref="CmdletOperationBase"/> for details
/// wrapper of cmdlet, <seealso cref="CmdletOperationBase"/> for details.
/// </param>
public void ProcessRemainActions(CmdletOperationBase cmdletOperation)
{
Expand Down Expand Up @@ -187,7 +187,7 @@ public void ProcessRemainActions(CmdletOperationBase cmdletOperation)

/// <summary>
/// <para>
/// Get action object from action queue
/// Get action object from action queue.
/// </para>
/// </summary>
/// <param name="action">Next action to execute.</param>
Expand Down Expand Up @@ -296,8 +296,7 @@ protected CimSessionProxy CreateCimSessionProxy(string computerName)
/// <param name="computerName"></param>
/// <param name="cimInstance"></param>
/// <returns></returns>
protected CimSessionProxy CreateCimSessionProxy(string computerName,
CimInstance cimInstance)
protected CimSessionProxy CreateCimSessionProxy(string computerName, CimInstance cimInstance)
{
CimSessionProxy proxy = new CimSessionProxy(computerName, cimInstance);
this.SubscribeEventAndAddProxytoCache(proxy);
Expand Down Expand Up @@ -445,7 +444,7 @@ protected bool Disposed
{
get
{
return (Interlocked.Read(ref this._disposed) == 1);
return Interlocked.Read(ref this._disposed) == 1;
}
}

Expand All @@ -461,6 +460,7 @@ protected bool Disposed
public void Dispose()
{
Dispose(true);

// This object will be cleaned up by the Dispose method.
// Therefore, you should call GC.SuppressFinalize to
// take this object off the finalization queue
Expand Down Expand Up @@ -525,6 +525,7 @@ private void Cleanup()
temporaryProxy = new List<CimSessionProxy>(this.cimSessionProxyCache);
this.cimSessionProxyCache.Clear();
}

// clean up all proxy objects
foreach (CimSessionProxy proxy in temporaryProxy)
{
Expand All @@ -549,12 +550,12 @@ private void Cleanup()
/// <summary>
/// Lock object.
/// </summary>
private readonly object myLock = new object();
private readonly object a_lock = new object();

/// <summary>
/// Number of active operations.
/// </summary>
private UInt32 operationCount = 0;
private uint operationCount;

/// <summary>
/// Event to notify ps thread that more action is available.
Expand Down Expand Up @@ -594,6 +595,5 @@ private void Cleanup()
internal const string ComputerNameArgument = @"ComputerName";
internal const string CimSessionArgument = @"CimSession";
#endregion

}
}