42 lines
846 B
Plaintext
42 lines
846 B
Plaintext
///////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Microsoft Research Singularity
|
|
//
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
//
|
|
// File: Service\Test\Counter\CounterWorker.sg
|
|
//
|
|
// Note:
|
|
//
|
|
using System;
|
|
|
|
namespace Microsoft.Singularity.Services.Counter
|
|
{
|
|
internal sealed class Counter
|
|
{
|
|
private int count;
|
|
|
|
internal Counter()
|
|
{
|
|
count = 0;
|
|
}
|
|
|
|
internal void Increment()
|
|
{
|
|
lock (this) {
|
|
if (count < Int32.MaxValue) {
|
|
++count;
|
|
}
|
|
else {
|
|
count = 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
internal int Count
|
|
{
|
|
get { return count; }
|
|
}
|
|
}
|
|
}
|