Passing tokens between threads
David Holmes
David.Holmes at oracle.com
Wed May 5 18:28:43 PDT 2010
Tony,
Tony Guan said the following on 05/05/10 02:03:
> In my current project, I need to be able to pass tokens between
> certain threads inside VM. While it's easy when Thread A is directly
> calling the Thread B's start().
>
> But usually, the thread B is not directly created and started by
> thread A, for example, thread pooling. In this case, if I need to pass
> a token from thread A to thread B(which is triggered by A), I guess I
> will need to monitor the object that B is waiting on.
>
> While I am still pondering over this, is there any other advice?
I don't quite understand what you are asking. In shared-memory
multi-threading the primary communication path between threads is
shared-memory. So passing a "token" is a matter of writing some data
into a memory location known to both threads. Then it is just a matter
of how much encapsulation/abstraction you want to put around that memory
location.
David Holmes
More information about the hotspot-runtime-dev
mailing list