MCPcopy Create free account
hub / github.com/Kitware/VTK / testThread

Function testThread

ThirdParty/libxml2/vtklibxml2/runtest.c:4221–4277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4219}
4220
4221static int
4222testThread(void)
4223{
4224 unsigned int i, repeat;
4225 BOOL ret;
4226 int res = 0;
4227
4228 xmlInitParser();
4229 for (repeat = 0; repeat < TEST_REPEAT_COUNT; repeat++) {
4230 xmlLoadCatalog(catalog);
4231 nb_tests++;
4232
4233 for (i = 0; i < num_threads; i++) {
4234 tid[i] = (HANDLE) - 1;
4235 }
4236
4237 for (i = 0; i < num_threads; i++) {
4238 DWORD useless;
4239
4240 tid[i] = CreateThread(NULL, 0,
4241 win32_thread_specific_data,
4242 (void *) &threadParams[i], 0,
4243 &useless);
4244 if (tid[i] == NULL) {
4245 fprintf(stderr, "CreateThread failed\n");
4246 return(1);
4247 }
4248 }
4249
4250 if (WaitForMultipleObjects(num_threads, tid, TRUE, INFINITE) ==
4251 WAIT_FAILED) {
4252 fprintf(stderr, "WaitForMultipleObjects failed\n");
4253 return(1);
4254 }
4255
4256 for (i = 0; i < num_threads; i++) {
4257 DWORD exitCode;
4258 ret = GetExitCodeThread(tid[i], &exitCode);
4259 if (ret == 0) {
4260 fprintf(stderr, "GetExitCodeThread failed\n");
4261 return(1);
4262 }
4263 CloseHandle(tid[i]);
4264 }
4265
4266 xmlCatalogCleanup();
4267 for (i = 0; i < num_threads; i++) {
4268 if (threadParams[i].okay == 0) {
4269 fprintf(stderr, "Thread %d handling %s failed\n",
4270 i, threadParams[i].filename);
4271 res = 1;
4272 }
4273 }
4274 }
4275
4276 return (res);
4277}
4278

Callers 1

threadsTestFunction · 0.85

Calls 4

xmlInitParserFunction · 0.85
xmlLoadCatalogFunction · 0.85
fprintfFunction · 0.85
xmlCatalogCleanupFunction · 0.85

Tested by

no test coverage detected