MCPcopy Create free account
hub / github.com/Snapchat/Valdi / attachThreadIfNeeded

Function attachThreadIfNeeded

libs/utils/src/utils/platform/JvmUtils.cpp:107–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107bool attachThreadIfNeeded(const char* threadName) {
108 // check if already attached
109 if (auto* jni = getEnv(); jni != nullptr)
110 return true;
111
112 SC_ASSERT(!pthread_getspecific(gJniPtr));
113 auto* jni = attachJniInternal(threadName);
114 auto result = pthread_setspecific(gJniPtr, jni);
115 assert(result == 0);
116 return result == 0;
117}
118
119void attachJni(const char* threadName) {
120 attachJniInternal(threadName);

Callers

nothing calls this directly

Calls 2

attachJniInternalFunction · 0.85
getEnvFunction · 0.70

Tested by

no test coverage detected