summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-07-09 18:30:22 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-07-09 18:30:22 -0700
commitd63c5d4e930732ef2a41266fcc8237cb1ec81320 (patch)
tree8c58ce351eb9e9c317180f8d21becaf37c19c5e9
parent8445ca6c3ba9b7cee6d20f5919e3b3ba8e6b8c96 (diff)
parentbbf0bde5d8311f84b6f0a8d018d78a78429602b7 (diff)
downloadframeworks_base-d63c5d4e930732ef2a41266fcc8237cb1ec81320.zip
frameworks_base-d63c5d4e930732ef2a41266fcc8237cb1ec81320.tar.gz
frameworks_base-d63c5d4e930732ef2a41266fcc8237cb1ec81320.tar.bz2
am bbf0bde5: am faccac76: Make a stupid thing about the glue less stupid.
Merge commit 'bbf0bde5d8311f84b6f0a8d018d78a78429602b7' * commit 'bbf0bde5d8311f84b6f0a8d018d78a78429602b7': Make a stupid thing about the glue less stupid.
-rw-r--r--native/glue/threaded_app/threaded_app.c26
-rw-r--r--native/include/android_glue/threaded_app.h6
2 files changed, 14 insertions, 18 deletions
diff --git a/native/glue/threaded_app/threaded_app.c b/native/glue/threaded_app/threaded_app.c
index 16c905c..2411e93 100644
--- a/native/glue/threaded_app/threaded_app.c
+++ b/native/glue/threaded_app/threaded_app.c
@@ -29,18 +29,6 @@
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "threaded_app", __VA_ARGS__))
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "threaded_app", __VA_ARGS__))
-void android_app_destroy(struct android_app* android_app) {
- LOGI("android_app_destroy!");
- pthread_mutex_lock(&android_app->mutex);
- if (android_app->inputQueue != NULL) {
- AInputQueue_detachLooper(android_app->inputQueue);
- }
- android_app->destroyed = 1;
- pthread_cond_broadcast(&android_app->cond);
- pthread_mutex_unlock(&android_app->mutex);
- // Can't touch android_app object after this.
-}
-
int8_t android_app_read_cmd(struct android_app* android_app) {
int8_t cmd;
if (read(android_app->msgread, &cmd, sizeof(cmd)) == sizeof(cmd)) {
@@ -97,6 +85,18 @@ int32_t android_app_exec_cmd(struct android_app* android_app, int8_t cmd) {
return android_app->destroyRequested ? 0 : 1;
}
+static void android_app_destroy(struct android_app* android_app) {
+ LOGI("android_app_destroy!");
+ pthread_mutex_lock(&android_app->mutex);
+ if (android_app->inputQueue != NULL) {
+ AInputQueue_detachLooper(android_app->inputQueue);
+ }
+ android_app->destroyed = 1;
+ pthread_cond_broadcast(&android_app->cond);
+ pthread_mutex_unlock(&android_app->mutex);
+ // Can't touch android_app object after this.
+}
+
static void* android_app_entry(void* param) {
struct android_app* android_app = (struct android_app*)param;
@@ -110,6 +110,8 @@ static void* android_app_entry(void* param) {
pthread_mutex_unlock(&android_app->mutex);
android_main(android_app);
+
+ android_app_destroy(android_app);
return NULL;
}
diff --git a/native/include/android_glue/threaded_app.h b/native/include/android_glue/threaded_app.h
index 491389b..adfdbea 100644
--- a/native/include/android_glue/threaded_app.h
+++ b/native/include/android_glue/threaded_app.h
@@ -144,12 +144,6 @@ enum {
};
/**
- * Call if android_app->destroyRequested is non-zero. Upon return, the
- * android_app structure is no longer valid and must not be touched.
- */
-void android_app_destroy(struct android_app* android_app);
-
-/**
* Call when ALooper_pollAll() returns LOOPER_ID_MAIN, reading the next
* app command message.
*/