Friday, August 2, 2002 07:21 AM
How can I use a shared memory zone that can be readed or/and writed by 2 or more independents threads ?
Re: using shared memory in Java
Sunday, September 1, 2002 02:24 PM
There are a couple ways that you can implement this.1. Use SDK 1.4.1 and in it is the Shared Memory classes.I cannot remember which library they are in.2. If all the independent threads you are speaking ofreside in the same JVM, there is a very elegant way of executing exactly what you want. Create a static queuethat all the threads may access. Control the Thread(s)access to the Queue through synchronization on the recv()method of the queue. If the queue is empty.. make the thread block by 'wait'ing. Whenever any thread adds to thequeue.. that thread calls notify on the queue thus wakingup a 'wait'ing thread. This can be modified in a similarway for the access of arrays.Good Luck
Friday, August 2, 2002 07:24 AM
Member variables of a class are shared by all the threads in the class.