[concurrency-interest] JNI signaling back to athread/concurrentstructure?

David Holmes davidcholmes at aapt.net.au
Tue Jul 14 21:07:11 EDT 2015


Andrew Lentvorski writes:
> On 7/14/15, 2:21 AM, David Holmes wrote:
>
> > Use JNI to invoke Thread.interrupt. That will unblock the sleep, or most
> > other concurrency-based blocking mechanisms.
>
> Is that going to be kosher?
>
> Calling back from JNI to Java to to invoke Thread.interrupt seems like
> I'm going to set off a cascade of actions will trigger priority inversion.
>
> Any allocation of memory will pull a mutex that will cause a priority
> inversion.

You have no choice but to make a JNI call back into Java (unless you
introduce a native mechanism to implement your own blocking within a Java
data structure). If you don't want to do JNI calls from the system thread
executing the audio callback then you will need to introduce an intermediary
native thread to do it.

Priority issues are outside the scope of the JVM - you are now dealing with
Android specifics, so you will need to ask Android folk about that.

David

> -a
>
>



More information about the Concurrency-interest mailing list