Advanced Distributed Systems module at HSLU
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Threading;
|
|
|
|
namespace Sync_Ueb01_Counter
|
|
{
|
|
class Counter
|
|
{
|
|
private int count = 0;
|
|
private static object syncRoot = new();
|
|
|
|
public int NextNumber()
|
|
{
|
|
lock (syncRoot)
|
|
{
|
|
count++;
|
|
return count;
|
|
}
|
|
}
|
|
}
|
|
} |