FACT++  1.0
int dim_jni_attachThread ( JNIEnv **  env)

Definition at line 171 of file dim_jni.c.

References MainThreadId, TheEnv, and theJavaVM.

Referenced by callClientErrorHandler(), callServerErrorHandler(), callServerExitHandler(), callTimerHandler(), decodeData(), JNI_OnLoad(), send_callback(), and server_getInfo_callback().

172 {
173 #ifdef WIN32
174  DWORD tid;
175  tid = GetCurrentThreadId();
176 #else
177 #ifdef __linux__
178  pthread_t tid;
179  tid = pthread_self();
180 #else
181  int tid = 0;
182 #endif
183 #endif
184 
185  if(tid == MainThreadId)
186  {
187  *env = TheEnv;
188  return 0;
189  }
190  (*theJavaVM)->AttachCurrentThread(theJavaVM, (void *)env, NULL);
191  if(MainThreadId == 0)
192  {
193  MainThreadId = tid;
194  }
195  return 1;
196 }
JavaVM * theJavaVM
Definition: dim_jni.c:85
JNIEnv * TheEnv
Definition: dim_jni.c:143
int MainThreadId
Definition: dim_jni.c:140

+ Here is the caller graph for this function: