]>
Commit | Line | Data |
---|---|---|
0980b64f JB |
1 | --- cvs-fast-export-1.66/atom.c.orig 2024-04-07 15:44:05.728144147 +0200 |
2 | +++ cvs-fast-export-1.66/atom.c 2024-04-07 15:49:33.189703469 +0200 | |
3 | @@ -100,24 +100,24 @@ const char *atom(const char *string) | |
4 | hash_bucket_t *b; | |
5 | int len; | |
0b0bfc9a | 6 | |
0980b64f JB |
7 | +#ifdef THREADS |
8 | + if (threads > 1) { | |
9 | + pthread_mutex_lock(&bucket_mutex); | |
0b0bfc9a | 10 | + } |
0980b64f JB |
11 | +#endif /* THREADS */ |
12 | while ((b = *head)) { | |
13 | collision: | |
14 | if (b->hash == hash && !strcmp(string, b->string)) { | |
15 | +#ifdef THREADS | |
16 | + if (threads > 1) { | |
17 | + pthread_mutex_unlock(&bucket_mutex); | |
18 | + } | |
19 | +#endif /* THREADS */ | |
20 | return b->string; | |
21 | } | |
22 | head = &(b->next); | |
23 | } | |
24 | -#ifdef THREADS | |
25 | - if (threads > 1) { | |
26 | - pthread_mutex_lock(&bucket_mutex); | |
27 | - } | |
28 | -#endif /* THREADS */ | |
29 | if ((b = *head)) { | |
30 | -#ifdef THREADS | |
31 | - if (threads > 1) { | |
32 | - pthread_mutex_unlock(&bucket_mutex); | |
33 | - } | |
34 | -#endif /* THREADS */ | |
35 | goto collision; | |
36 | } | |
0b0bfc9a | 37 | |
0980b64f JB |
38 | @@ -157,24 +157,24 @@ const cvs_number *atom_cvs_number(const |
39 | number_bucket_t **head = &number_buckets[bucket]; | |
40 | number_bucket_t *b; | |
0b0bfc9a | 41 | |
0980b64f JB |
42 | +#ifdef THREADS |
43 | + if (threads > 1) { | |
44 | + pthread_mutex_lock(&number_bucket_mutex); | |
0b0bfc9a | 45 | + } |
0980b64f JB |
46 | +#endif /* THREADS */ |
47 | while ((b = *head)) { | |
48 | collision: | |
49 | if (cvs_number_equal(&b->number, &n)) { | |
50 | +#ifdef THREADS | |
51 | + if (threads > 1) { | |
52 | + pthread_mutex_unlock(&number_bucket_mutex); | |
53 | + } | |
54 | +#endif /* THREADS */ | |
55 | return &b->number; | |
56 | } | |
57 | head = &(b->next); | |
58 | } | |
59 | -#ifdef THREADS | |
60 | - if (threads > 1) { | |
61 | - pthread_mutex_lock(&number_bucket_mutex); | |
62 | - } | |
63 | -#endif /* THREADS */ | |
64 | if ((b = *head)) { | |
65 | -#ifdef THREADS | |
66 | - if (threads > 1) { | |
67 | - pthread_mutex_unlock(&number_bucket_mutex); | |
68 | - } | |
69 | -#endif /* THREADS */ | |
70 | goto collision; | |
71 | } | |
0b0bfc9a | 72 | |
0980b64f JB |
73 | --- cvs-fast-export-1.66/revcvs.c.orig 2024-04-07 15:44:05.731477463 +0200 |
74 | +++ cvs-fast-export-1.66/revcvs.c 2024-04-07 15:56:06.944236984 +0200 | |
0b0bfc9a JB |
75 | @@ -22,6 +22,9 @@ |
76 | #endif | |
77 | ||
78 | const master_dir *root_dir = NULL; | |
79 | +#ifdef THREADS | |
80 | +static pthread_mutex_t root_dir_mutex = PTHREAD_MUTEX_INITIALIZER; | |
81 | +#endif | |
82 | ||
0980b64f JB |
83 | static const char *fileop_name(const char *rectified) { |
84 | size_t rlen = strlen(rectified); | |
85 | @@ -79,24 +82,24 @@ static const master_dir *atom_dir(const | |
86 | dir_bucket **head = &dir_buckets[HASH_VALUE(dirname) % DIR_BUCKETS]; | |
87 | dir_bucket *b; | |
0b0bfc9a | 88 | |
0980b64f JB |
89 | +#ifdef THREADS |
90 | + if (threads > 1) { | |
91 | + pthread_mutex_lock(&dir_bucket_mutex); | |
0b0bfc9a | 92 | + } |
0980b64f JB |
93 | +#endif /* THREADS */ |
94 | while ((b = *head)) { | |
95 | collision: | |
96 | if (b->dir.name == dirname) { | |
97 | +#ifdef THREADS | |
98 | + if (threads > 1) { | |
99 | + pthread_mutex_unlock(&dir_bucket_mutex); | |
100 | + } | |
101 | +#endif /* THREADS */ | |
102 | return &(b->dir); | |
103 | } | |
104 | head = &(b->next); | |
105 | } | |
106 | -#ifdef THREADS | |
107 | - if (threads > 1) { | |
108 | - pthread_mutex_lock(&dir_bucket_mutex); | |
109 | - } | |
110 | -#endif /* THREADS */ | |
111 | if ((b = *head)) { | |
112 | -#ifdef THREADS | |
113 | - if (threads > 1) { | |
114 | - pthread_mutex_unlock(&dir_bucket_mutex); | |
115 | - } | |
116 | -#endif /* THREADS */ | |
117 | goto collision; | |
118 | } | |
119 | b = xmalloc(sizeof(dir_bucket), __func__); | |
120 | @@ -859,9 +862,17 @@ cvs_commit *cvs_master_digest(cvs_file * | |
121 | cvs_branch *cb; | |
122 | cvs_version *ctrunk = NULL; | |
0b0bfc9a JB |
123 | |
124 | +#ifdef THREADS | |
125 | + if (threads > 1) | |
126 | + pthread_mutex_lock(&root_dir_mutex); | |
127 | +#endif | |
0980b64f JB |
128 | if (!root_dir) { |
129 | root_dir = atom_dir(atom("\0")); | |
130 | } | |
0b0bfc9a JB |
131 | +#ifdef THREADS |
132 | + if (threads > 1) | |
133 | + pthread_mutex_unlock(&root_dir_mutex); | |
134 | +#endif | |
0980b64f | 135 | build_rev_master(cvs, master); |
0b0bfc9a | 136 | #if CVSDEBUG |
0980b64f | 137 | char buf[CVS_MAX_REV_LEN]; |