Can a thread use a value of a global variable?


i´m creating a thread that takes as parameter dispatchInputs which is an CString array but in mean while i need to use "env" in DispFrontEnd function, can a thread use the global variable "env" ? if not how how can i pass it as argument to DispFrontEnd ?

static JNIEnv *env;
static JavaVM *jvm; 

JNIEnv* startJVM()
 JNIEnv *env;
 JavaVM * jvm;
 env = create_vm(&jvm);
 if ( env == NULL) { logloc->LogDebug("1env == NULL ******************");}
 return env;

env = startJVM();

hDispThread = (HANDLE)_beginthread(DispFrontEnd,0,(void *)dispatchInputs);

static void DispFrontEnd(void * indArr)

 CString str;

 CString dest[56];
    char* orig_idx_ptr = reinterpret_cast(indArr);
    int array_size = 56;
    memcpy(dest, orig_idx_ptr, array_size); 

 str.Format("DISPATCH INPUTS: (Trace Detail)[%s] (Session State ID)[%s] (SessionID)[%s] (MediaTypeID)[%s] (MediaCode)[%s] (5)[%s] (6)[%s] (7)[%s] (8)[%s] (9)[%s] (10)[%s] (11)[%s] (12)[%s] (13)[%s] " , dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7], dest[8], dest[9], dest[10], dest[11], dest[12], dest[13]);
 logloc->LogMethod(str );
 if (env != NULL)

  jclass clsR = NULL;
  jclass arqClass = NULL;
  jclass messageToHostClass = NULL;

  jobject jobjRetData = NULL;

  jobjectArray jobjWOArr = NULL;
  jobjectArray getResponseArray = NULL;

  jmethodID getResponse = NULL;
  jmethodID getMessageToHost = NULL;

  arqClass = env->FindClass("BizB/Arq");


Tks Rev

yes a thread can use the value of a global variable!