Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bb9ba8ba authored by Mathias Agopian's avatar Mathias Agopian
Browse files

BitTube::read now handles EAGAIN

Change-Id: Iacda2386342ba0727bbf278f6c597488d5467bb8
parent 3f15700a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ sensors_data_poll(JNIEnv *env, jclass clazz, jint nativeQueue,
    ASensorEvent event;

    res = queue->read(&event, 1);
    if (res == -EAGAIN) {
    if (res == 0) {
        res = queue->waitForEvent();
        if (res != NO_ERROR)
            return -1;
+5 −0
Original line number Diff line number Diff line
@@ -97,6 +97,11 @@ ssize_t BitTube::read(void* vaddr, size_t size)
        len = ::read(mReceiveFd, vaddr, size);
        err = len < 0 ? errno : 0;
    } while (err == EINTR);
    if (err == EAGAIN || err == EWOULDBLOCK) {
        // EAGAIN means that we have non-blocking I/O but there was
        // no data to be read. Nothing the client should care about.
        return 0;
    }
    return err == 0 ? len : -err;
}