Merge "return errors properly in BitTube and SensorEventQueue" into jb-dev
This commit is contained in:
commit
ddcb1c2bbd
@ -140,8 +140,7 @@ ssize_t BitTube::sendObjects(const sp<BitTube>& tube,
|
|||||||
ssize_t size = tube->write(vaddr, objSize);
|
ssize_t size = tube->write(vaddr, objSize);
|
||||||
if (size < 0) {
|
if (size < 0) {
|
||||||
// error occurred
|
// error occurred
|
||||||
numObjects = -size;
|
return size;
|
||||||
break;
|
|
||||||
} else if (size == 0) {
|
} else if (size == 0) {
|
||||||
// no more space
|
// no more space
|
||||||
break;
|
break;
|
||||||
@ -160,8 +159,7 @@ ssize_t BitTube::recvObjects(const sp<BitTube>& tube,
|
|||||||
ssize_t size = tube->read(vaddr, objSize);
|
ssize_t size = tube->read(vaddr, objSize);
|
||||||
if (size < 0) {
|
if (size < 0) {
|
||||||
// error occurred
|
// error occurred
|
||||||
numObjects = -size;
|
return size;
|
||||||
break;
|
|
||||||
} else if (size == 0) {
|
} else if (size == 0) {
|
||||||
// no more messages
|
// no more messages
|
||||||
break;
|
break;
|
||||||
|
@ -79,14 +79,21 @@ status_t SensorEventQueue::waitForEvent() const
|
|||||||
const int fd = getFd();
|
const int fd = getFd();
|
||||||
sp<Looper> looper(getLooper());
|
sp<Looper> looper(getLooper());
|
||||||
|
|
||||||
|
int events;
|
||||||
int32_t result;
|
int32_t result;
|
||||||
do {
|
do {
|
||||||
result = looper->pollOnce(-1);
|
result = looper->pollOnce(-1, NULL, &events, NULL);
|
||||||
if (result == ALOOPER_EVENT_ERROR) {
|
if (result == ALOOPER_POLL_ERROR) {
|
||||||
ALOGE("SensorEventQueue::waitForEvent error (errno=%d)", errno);
|
ALOGE("SensorEventQueue::waitForEvent error (errno=%d)", errno);
|
||||||
result = -EPIPE; // unknown error, so we make up one
|
result = -EPIPE; // unknown error, so we make up one
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (events & ALOOPER_EVENT_HANGUP) {
|
||||||
|
// the other-side has died
|
||||||
|
ALOGE("SensorEventQueue::waitForEvent error HANGUP");
|
||||||
|
result = -EPIPE; // unknown error, so we make up one
|
||||||
|
break;
|
||||||
|
}
|
||||||
} while (result != fd);
|
} while (result != fd);
|
||||||
|
|
||||||
return (result == fd) ? status_t(NO_ERROR) : result;
|
return (result == fd) ? status_t(NO_ERROR) : result;
|
||||||
|
Loading…
Reference in New Issue
Block a user