對於那些不熟悉,下面是用於處理協調Peterson算法: int No_Of_Processes; // Number of processes
int turn; // Whose turn is it?
int interested[No_Of_Processes]; // All values initially FALSE
void enter_region(int process
我要讓我的代碼multithreadable,爲此我需要修改字典成ConcurrentDictionary。我看了一下ConcurrentDictionary,查了一些例子,但我仍然需要一隻手放在這樣的: 這裏是原來的代碼(單線程) private IDictionary<string, IDictionary<string, Task>> _tasks;
public override IDi