MCPcopy Create free account
hub / github.com/OSGeo/gdal / TEST

Function TEST

autotest/cpp/testthreadcond.cpp:120–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120TEST(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

Callers

nothing calls this directly

Calls 9

CPLTestBoolFunction · 0.85
CPLCreateCondFunction · 0.85
CPLCreateMutexFunction · 0.85
CPLReleaseMutexFunction · 0.85
CPLCreateThreadFunction · 0.85
CPLCreateJoinableThreadFunction · 0.85
CPLJoinThreadFunction · 0.85
CPLDestroyCondFunction · 0.85
CPLDestroyMutexFunction · 0.85

Tested by

no test coverage detected