| 105 | } |
| 106 | |
| 107 | bool 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 | |
| 119 | void attachJni(const char* threadName) { |
| 120 | attachJniInternal(threadName); |
nothing calls this directly
no test coverage detected