Synchronized sur 2 tableaux
Bonjour ,
J'ai une classe qui s'appelle Information :
Code:
1 2 3 4 5 6 7
|
public class Information
{
public int [] nom;
public int [] age;
} |
Il y a des Threads qui accèdent en partagent ces infos, et donc je souhaiterai mettre un Synchronized sur les deux tableaux afin de les mettre à jour...
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
public class MonThread extends Thread
{
public Information Info;
public MonThread
{
this.Info = new Information();
}
public void run
{
while (!this.isInterrupted())
{
synchronized(this.Info.nom) //Ici comment j'ajoute le tableau age??
{
//les traitements que je souhaites faire
}
}
}
} |
Merci pour votre aide :mrgreen: