| 41 | FileLock *flockPtr = nullptr; |
| 42 | |
| 43 | void *threadFunction(void *lpParam) { |
| 44 | auto sem = (sem_t *) lpParam; |
| 45 | sem_post(sem); |
| 46 | auto index = threadIndex; |
| 47 | cout << "Thread " << index << " started" << endl; |
| 48 | |
| 49 | //auto mmkv = MMKV::mmkvWithID(MMKV_ID, MMKV_MULTI_PROCESS); |
| 50 | // this should hold forever |
| 51 | //mmkv->count(); |
| 52 | flockPtr->lock(SharedLockType); |
| 53 | //flockPtr->unlock(SharedLockType); |
| 54 | |
| 55 | // something is wrong with inter-process lock |
| 56 | sem_post(semEnded); |
| 57 | cout << "Thread " << index << " ended" << endl; |
| 58 | return nullptr; |
| 59 | } |
| 60 | |
| 61 | bool threadTest() { |
| 62 | sem_t *semParent = sem_open("/mmkv_main", O_CREAT, 0644, 0); |