aboutsummaryrefslogtreecommitdiffstats
path: root/android/async-utils.c
diff options
context:
space:
mode:
authorVladimir Chtchetkine <vchtchetkine@google.com>2012-04-03 10:27:12 -0700
committerVladimir Chtchetkine <vchtchetkine@google.com>2012-04-03 16:13:42 -0700
commitef4ccd385650612a830a098f4b1eac48482b65b3 (patch)
treedad74ea321507a3a0912a0142387e8df3bff901f /android/async-utils.c
parent6dc5c2cef91004488f04fc6e9c0946f6d3a29705 (diff)
downloadexternal_qemu-ef4ccd385650612a830a098f4b1eac48482b65b3.zip
external_qemu-ef4ccd385650612a830a098f4b1eac48482b65b3.tar.gz
external_qemu-ef4ccd385650612a830a098f4b1eac48482b65b3.tar.bz2
Make all async I/O object referenced.
Since it's hard to control lifespan of an object in asynchronous environment, we should make all AsyncXxx objects a referenced objecst, that will self-destruct when its reference count drops to zero, indicating that the last client that used the object has abandoned it. Change-Id: I6f8194aa14e52a23a8772d827583782989654504
Diffstat (limited to 'android/async-utils.c')
-rw-r--r--android/async-utils.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/android/async-utils.c b/android/async-utils.c
index e410de0..9732111 100644
--- a/android/async-utils.c
+++ b/android/async-utils.c
@@ -268,3 +268,14 @@ asyncConnector_run(AsyncConnector* ac)
return ASYNC_COMPLETE;
}
}
+
+int
+asyncConnector_stop(AsyncConnector* ac)
+{
+ if (ac->state == CONNECT_CONNECTING) {
+ loopIo_dontWantWrite(ac->io);
+ ac->state = CONNECT_COMPLETED;
+ return 0;
+ }
+ return -1;
+}