I know of concepts that allow inter-process communication. My program needs to launch a second thread. I know how to pass or “push” data from one thread to another from Java/Android, but I have not seen a lot of information regarding “pulling” data. The child thread needs to grab data on the parent thread every so often. How is this done?
I know of concepts that allow inter-process communication. My program needs to launch a
Share
Since threads share memory you can just use a thread safe data structure. Refer to java.util.concurrent for some. Everything in that package is designed for multi threaded situations.
In your case you might want to use a LinkedBlockingQueue. This way the parent thread can put things into the queue, and the child thread can grab it off whenever it likes. It also allows the child thread to block if the Queue is empty.