Code cleanup.
[TD_SE.git] / peterson / peterson.c
CommitLineData
155664db
JB
1#define FALSE 0
2#define TRUE 1
3#define N 2 // nombre de processus
4int turn; // à qui le tour?
5int flags[N]; // initialement valeurs FALSE
6
7/* attente active */
8
9static void enter_region(int process) { // entrée en SC
10 int other;
11 other = 1 - process;
12 flags[process] = TRUE;
13 turn = process;
5498be61 14 while (turn == process && flags[other] == TRUE);
155664db
JB
15}
16
17static void leave_region(int process) { // sortie de SC
18 flags[process] = FALSE;
19}
20
21int main() {
22
23}