diff options
author | Nicolas Roard <> | 2009-03-27 16:50:56 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-27 16:50:56 -0700 |
commit | 209d4152b638561f354578ab12ac98586d611fe5 (patch) | |
tree | 0c310a0603fdcc186d02c8d1ff2da3ef6f4a25bc /core/java/android/webkit/gears | |
parent | 38e260a62020af0e6ca45d5a9cc3f8e8c9a2842c (diff) | |
download | frameworks_base-209d4152b638561f354578ab12ac98586d611fe5.zip frameworks_base-209d4152b638561f354578ab12ac98586d611fe5.tar.gz frameworks_base-209d4152b638561f354578ab12ac98586d611fe5.tar.bz2 |
AI 143185: am: CL 142930 Adds a straightforward abort() function in addition to interrupt(). Used on the gears C++ side to get rid of the thread leaking introduced with the HttpRequest refactoring.
Original author: nicolasroard
Merged from: //branches/cupcake/...
Automated import of CL 143185
Diffstat (limited to 'core/java/android/webkit/gears')
-rw-r--r-- | core/java/android/webkit/gears/ApacheHttpRequestAndroid.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/core/java/android/webkit/gears/ApacheHttpRequestAndroid.java b/core/java/android/webkit/gears/ApacheHttpRequestAndroid.java index 0569255..529e666 100644 --- a/core/java/android/webkit/gears/ApacheHttpRequestAndroid.java +++ b/core/java/android/webkit/gears/ApacheHttpRequestAndroid.java @@ -1000,12 +1000,23 @@ public final class ApacheHttpRequestAndroid { return true; } + /** + * Called by the main thread to interrupt the child thread. + * We do not set mConnectionFailed here as we still need the + * ability to receive a null packet for sendPostData(). + */ + public synchronized void abort() { + if (Config.LOGV) { + Log.i(LOG_TAG, "ABORT CALLED"); + } + if (mMethod != null) { + mMethod.abort(); + } + } /** - * Interrupt a blocking IO operation. This will cause the child - * thread to expediently return from an operation if it was stuck at - * the time. Note that this inherently races, and unfortunately - * requires the caller to loop. + * Interrupt a blocking IO operation and wait for the + * thread to complete. */ public synchronized void interrupt() { if (Config.LOGV) { |