Interface ThreadsListener
public interface ThreadsListener
Listener to be notified about changes of threads in guest language application.
Use
Instrumenter.attachThreadsListener(com.oracle.truffle.api.instrumentation.ThreadsListener, boolean)
to register an implementation of this listener. Use EventBinding.dispose() to unregister.
The listener gets called when a thread is initialized for use in a context
or thread-related resources are disposed in a context. The notification calls do not say anything
about the actual life-time of the thread as such, which may live before the initialization and
may continue to live after the disposal.
- Since:
- 0.30
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidonThreadDisposed(TruffleContext context, Thread thread) Notifies about disposal of thread-related resources that were used for a guest language execution in aTruffleContext.voidonThreadInitialized(TruffleContext context, Thread thread) Notifies about initialization of a thread to be used for a guest language execution in aTruffleContext.
-
Method Details
-
onThreadInitialized
Notifies about initialization of a thread to be used for a guest language execution in aTruffleContext. If this method throws anAbstractTruffleExceptionthe exception interop messages may be executed without a context being entered.- Parameters:
context- the context the thread is initialized inthread- the initialized thread- Since:
- 0.30
-
onThreadDisposed
Notifies about disposal of thread-related resources that were used for a guest language execution in aTruffleContext.- Parameters:
context- the context the thread is disposed fromthread- the thread- Since:
- 0.30
-