Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Regarding synchronization?  RSS feed

 
Sachindra Pratap
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,query as follows.
I have a one function which is public static void func_name().

Inside the function,
there are three steps.

for each step i.e step1 thred1 a[i]= new thred1[4]; //
a[i]= new thred1(var);

step2. thred2 b[]= new thred2[4];//declare inside constructor
b[i]= new thred2(var);

step3. thread3 c[]=new thread3[4];
c[i]=new thread3(var);

This function is static as well as ,
these are also static means somethin like this

static class thred1 extends Thread{
int var1;
thred1(int var1){this.var1=var1;}
public void run(){
}
}

suppose function is called in very small interval(function is synchronized also and it is static) ,
so is there any chance of var1 getting changed.

do reply.
regards
sachindra
 
Dariusz Kordonski
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't quite understand your question. It would be simpler if you just posted your complete code and asked a specific question regarding it. You can use [CODE] markups for that.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!