Parent Directory | Revision Log
+ My_InitializeCriticalSection + My_DeleteCriticalSection + various minor changes (Makefile, MAX_THREADS)
1 | joko | 1.2 | |
2 | #include <stdlib.h> | ||
3 | #include "bakery.h" | ||
4 | |||
5 | void My_InitializeCriticalSection( MY_LPCRITICAL_SECTION * sec ) { | ||
6 | |||
7 | int i; | ||
8 | |||
9 | /* Datenstruktur "erzeugen" */ | ||
10 | *sec = malloc(sizeof(struct _crit_sec)); | ||
11 | |||
12 | /* Datenstruktur mit "0" initialisieren */ | ||
13 | for (i = 0; i < MAX_THREADS; i++) { | ||
14 | (*sec)->choosing[i] = 0; | ||
15 | (*sec)->number[i] = 0; | ||
16 | } | ||
17 | |||
18 | } | ||
19 | |||
20 | void My_DeleteCriticalSection( MY_LPCRITICAL_SECTION sec ) { | ||
21 | |||
22 | /* Datenstruktur freigeben */ | ||
23 | free(sec); | ||
24 | |||
25 | } |
MailToCvsAdmin">MailToCvsAdmin | ViewVC Help |
Powered by ViewVC 1.1.26 |