Fast way to pass a simple java object from one thread to another
Posted
by Adal
on Stack Overflow
See other posts from Stack Overflow
or by Adal
Published on 2010-05-27T21:31:44Z
Indexed on
2010/05/27
21:41 UTC
Read the original article
Hit count: 205
I have a callback which receives an object. I make a copy of this object, and I must pass it on to another thread for further processing. It's very important for the callback to return as fast as possible. Ideally, the callback will write the copy to some sort of lock-free container.
I only have the callback called from a single thread and one processing thread.
I only need to pass a bunch of doubles to the other thread, and I know the maximum number of doubles (around 40).
Any ideas? I'm not very familiar with Java, so I don't know the usual ways to pass stuff between threads.
© Stack Overflow or respective owner