MCPcopy Create free account
hub / github.com/Tencent/MMKV / threadFunction

Function threadFunction

POSIX/demo/TestInterProcessLock.cpp:43–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41FileLock *flockPtr = nullptr;
42
43void *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
61bool threadTest() {
62 sem_t *semParent = sem_open("/mmkv_main", O_CREAT, 0644, 0);

Callers

nothing calls this directly

Calls 1

lockMethod · 0.45

Tested by

no test coverage detected