Skip to content

Commit ca63419

Browse files
committed
Use __gshared and synchronized for the apiExpectations
1 parent 082bf1a commit ca63419

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/utils.d

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,19 @@ struct APIExpectation
170170
}
171171
}
172172

173-
APIExpectation[] apiExpectations;
173+
__gshared APIExpectation[] apiExpectations;
174174

175175
void setAPIExpectations(Args...)(Args args)
176176
{
177177
import std.functional : toDelegate;
178178
import std.traits : Parameters;
179+
synchronized {
179180
apiExpectations.length = 0;
180181
foreach (i, arg; args)
181182
{
182183
static if (is(Args[i] : string))
183184
{
184-
apiExpectations ~= APIExpectation(arg);
185+
apiExpectations ~= APIExpectation(arg);
185186
}
186187
else
187188
{
@@ -202,6 +203,7 @@ void setAPIExpectations(Args...)(Args args)
202203
apiExpectations[$ - 1].reqHandler is null, "Either provide a reqHandler or a jsonHandler");
203204
}
204205
}
206+
}
205207
}
206208

207209
void postGitHubHook(string payload, string eventType = "pull_request",

0 commit comments

Comments
 (0)