| 233 | vector<string> arrStringKeys; |
| 234 | |
| 235 | void *threadFunction(void *lpParam) { |
| 236 | auto threadIndex = (size_t) lpParam; |
| 237 | auto mmkv = MMKV::mmkvWithID(MMKV_ID); |
| 238 | mmkv->lock(); |
| 239 | cout << "thread " << threadIndex << " starts" << endl; |
| 240 | mmkv->unlock(); |
| 241 | |
| 242 | auto segmentCount = keyCount / threadCount; |
| 243 | auto startIndex = segmentCount * threadIndex; |
| 244 | for (int32_t index = startIndex; index < startIndex + segmentCount; index++) { |
| 245 | mmkv->set(index, arrIntKeys[index]); |
| 246 | mmkv->set("str-" + to_string(index), arrStringKeys[index]); |
| 247 | } |
| 248 | |
| 249 | mmkv->lock(); |
| 250 | cout << "thread " << threadIndex << " ends" << endl; |
| 251 | mmkv->unlock(); |
| 252 | return nullptr; |
| 253 | } |
| 254 | |
| 255 | void threadTest() { |
| 256 | pthread_t threadHandles[threadCount] = {0}; |
nothing calls this directly
no test coverage detected