hi,
i wanna to implement this
a class that implement this :waiting() and wakeup() ,we call it event
we have only one event shared between so many threads
dynamic number of thread r executing waiting
and one other notify them by executing wakeup to notify all the thread which r waiting for this notification
for exemple look at this

class a {
public int a;=0;
event e=new event();
public a(){
callThread(); //creating thread 1
callThread(); //creating thread 2
callThread(); //creating thread 3
callThread(); //creating thread 4
callThread(); //creating thread 5
//this thread will notify them
new Thread (){
run(){
a=5;
e.wakeup()
}}.start();
}

//this methode will create and start a thread that will wait for a notification
// and after that it will print the value of the variable a
private void callThread(){
new Thread (){
run(){
e.waitng();
System.out.println(a);
}}.start();
}



normally all the threads will not print a only after the thread will notify all of them

the problem that i have
only one could see the notification
because as u see this is the class event

public final class Event {
/**
* variable used to store the notification if it takes place
* before being expected
*/
private boolean status = false;

public final synchronized void waiting() {
while (status == false ) {
try {
wait();
}
catch (InterruptedException e) {
}
}
status = false ;
}
// notify all waits on this event
public final synchronized void wakeUp() {
status = true;
notifyAll();
}


}



when the thread send notification the flag is set to true and only one could see that modification and go out from the wait status and modify the flag to false so the others always see the flag false so they could go out from waiting