Well, ��ll try to make myself clear:
"a.java" is a server that can create up to 20 threads. In order to not going over 20, there�s this variable "number_threads", so every time a
thread is created, it goes up by one.
"b.java" is the code of the thread, and if there�s an exception, or if it ends smoothly, it has to take one from "number_threads".
"c.java" is another thread that cooperates with "b.java" with the same conditions for the thread to end.
So i need that all the three of them (a.java, b.java and c.java) access to number_thread to modify its value, using a mutex (MUtual-EXclusive code, like a semaphore). My question is, how can i do so the three files share the same variable, each of them seeing the new value very time is modified, and how can they share the semaphore (mutex)?