OSDN Git Service

Remove races from JNI_OnLoad invocation.
authorAndy McFadden <fadden@android.com>
Fri, 10 Jul 2009 00:01:04 +0000 (17:01 -0700)
committerAndy McFadden <fadden@android.com>
Mon, 13 Jul 2009 21:39:07 +0000 (14:39 -0700)
commit2b82899181108c4ed290f8c6b6be13759b59768f
tree01225e758d179d932457ad97fd857f8630b60c85
parent3bef2909f1f0e8ea57e9934494b0ff8b7ecd8656
Remove races from JNI_OnLoad invocation.

Do not merge to master.  (This was copied from there to donut.)

The current implementation just calls JNI_OnLoad and returns a failure
result if that goes badly.  If a second load attempt is made after
dlopen() finishes but before JNI_OnLoad completes, it will succeed
immediately.

This is bad because (a) we might not have finished the initialization
steps in JNI_OnLoad, and (b) it's possible JNI_OnLoad will fail.  We now
wait for an in-progress JNI_OnLoad to complete before returning.  (This
also requires recognizing and handling recursive invocation.)
vm/Native.c