| OLD | NEW |
| 1 #include "libxml.h" | 1 #include "libxml.h" |
| 2 #include <stdlib.h> | 2 #include <stdlib.h> |
| 3 #include <stdio.h> | 3 #include <stdio.h> |
| 4 | 4 |
| 5 #if defined(LIBXML_THREAD_ENABLED) && defined(LIBXML_CATALOG_ENABLED) | 5 #if defined(LIBXML_THREAD_ENABLED) && defined(LIBXML_CATALOG_ENABLED) |
| 6 #include <libxml/globals.h> | 6 #include <libxml/globals.h> |
| 7 #include <libxml/threads.h> | 7 #include <libxml/threads.h> |
| 8 #include <libxml/parser.h> | 8 #include <libxml/parser.h> |
| 9 #include <libxml/catalog.h> | 9 #include <libxml/catalog.h> |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 for (i = 0; i < num_threads; i++) | 98 for (i = 0; i < num_threads; i++) |
| 99 { | 99 { |
| 100 results[i] = 0; | 100 results[i] = 0; |
| 101 tid[i] = (HANDLE) -1; | 101 tid[i] = (HANDLE) -1; |
| 102 } | 102 } |
| 103 | 103 |
| 104 for (i = 0; i < num_threads; i++) | 104 for (i = 0; i < num_threads; i++) |
| 105 { | 105 { |
| 106 DWORD useless; | 106 DWORD useless; |
| 107 » » » tid[i] = CreateThread(NULL, 0, | 107 » » » tid[i] = CreateThread(NULL, 0, |
| 108 thread_specific_data, testfiles[i], 0, &useless)
; | 108 thread_specific_data, testfiles[i], 0, &useless)
; |
| 109 if (tid[i] == NULL) | 109 if (tid[i] == NULL) |
| 110 { | 110 { |
| 111 perror("CreateThread"); | 111 perror("CreateThread"); |
| 112 exit(1); | 112 exit(1); |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 | 115 |
| 116 » » if (WaitForMultipleObjects (num_threads, tid, TRUE, INFINITE) ==
WAIT_FAILED) | 116 » » if (WaitForMultipleObjects (num_threads, tid, TRUE, INFINITE) ==
WAIT_FAILED) |
| 117 perror ("WaitForMultipleObjects failed"); | 117 perror ("WaitForMultipleObjects failed"); |
| 118 | 118 |
| 119 for (i = 0; i < num_threads; i++) | 119 for (i = 0; i < num_threads; i++) |
| 120 { | 120 { |
| 121 ret = GetExitCodeThread (tid[i], &results[i]); | 121 ret = GetExitCodeThread (tid[i], &results[i]); |
| 122 if (ret == 0) | 122 if (ret == 0) |
| 123 { | 123 { |
| 124 perror("GetExitCodeThread"); | 124 perror("GetExitCodeThread"); |
| 125 exit(1); | 125 exit(1); |
| 126 } | 126 } |
| 127 CloseHandle (tid[i]); | 127 CloseHandle (tid[i]); |
| 128 } | 128 } |
| 129 | 129 |
| 130 xmlCatalogCleanup(); | 130 xmlCatalogCleanup(); |
| 131 for (i = 0; i < num_threads; i++) { | 131 for (i = 0; i < num_threads; i++) { |
| 132 » » if (results[i] != (DWORD) Okay) | 132 » » if (results[i] != (DWORD) Okay) |
| 133 printf("Thread %d handling %s failed\n", i, testfiles[i]
); | 133 printf("Thread %d handling %s failed\n", i, testfiles[i]
); |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 | 136 |
| 137 xmlCleanupParser(); | 137 xmlCleanupParser(); |
| 138 xmlMemoryDump(); | 138 xmlMemoryDump(); |
| 139 | 139 |
| 140 return (0); | 140 return (0); |
| 141 } | 141 } |
| 142 | 142 |
| 143 #else /* !LIBXML_THREADS_ENABLED */ | 143 #else /* !LIBXML_THREADS_ENABLED */ |
| 144 int | 144 int |
| 145 main() | 145 main() |
| 146 { | 146 { |
| 147 fprintf(stderr, "libxml was not compiled with thread or catalog support\n"); | 147 fprintf(stderr, "libxml was not compiled with thread or catalog support\n"); |
| 148 return (0); | 148 return (0); |
| 149 } | 149 } |
| 150 #endif | 150 #endif |
| OLD | NEW |