singrdk/base/Services/Tests/Counter/Counter.sg

42 lines
846 B
Plaintext
Raw Normal View History

2008-03-05 09:52:00 -05:00
///////////////////////////////////////////////////////////////////////////////
//
// 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; }
}
}
}