| 118 | } |
| 119 | |
| 120 | TEST(testthreadcond, test) |
| 121 | { |
| 122 | int i; |
| 123 | CPLJoinableThread *apThreads[10]; |
| 124 | |
| 125 | bVerbose = CPLTestBool(CPLGetConfigOption("VERBOSE", "NO")); |
| 126 | |
| 127 | hCond = CPLCreateCond(); |
| 128 | hCondJobFinished = CPLCreateCond(); |
| 129 | |
| 130 | hClientMutex = CPLCreateMutex(); |
| 131 | CPLReleaseMutex(hClientMutex); |
| 132 | |
| 133 | CPLCreateThread(ProducerThread, nullptr); |
| 134 | |
| 135 | for (i = 0; i < 10; i++) |
| 136 | { |
| 137 | int *pi = (int *)malloc(sizeof(int)); |
| 138 | *pi = i; |
| 139 | apThreads[i] = CPLCreateJoinableThread(ConsumerThread, pi); |
| 140 | } |
| 141 | |
| 142 | for (i = 0; i < 10; i++) |
| 143 | { |
| 144 | CPLJoinThread(apThreads[i]); |
| 145 | } |
| 146 | |
| 147 | CPLDestroyCond(hCond); |
| 148 | CPLDestroyCond(hCondJobFinished); |
| 149 | CPLDestroyMutex(hClientMutex); |
| 150 | } |
| 151 | |
| 152 | } // namespace |
nothing calls this directly
no test coverage detected