mtp: Update PosixAsyncIO
Signed-off-by: sekaiacg <sekaiacg@gmail.com>
Change-Id: I833f39fa7c1bfbc280c480b001c20f903aa8a47d
diff --git a/mtp/ffs/PosixAsyncIO.h b/mtp/ffs/PosixAsyncIO.h
index 69ab9a5..2bcae4c 100644
--- a/mtp/ffs/PosixAsyncIO.h
+++ b/mtp/ffs/PosixAsyncIO.h
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,10 +17,11 @@
#ifndef _POSIXASYNCIO_H
#define _POSIXASYNCIO_H
+#include <condition_variable>
+#include <mutex>
#include <sys/cdefs.h>
#include <sys/types.h>
#include <time.h>
-#include <thread>
#include <unistd.h>
/**
@@ -28,18 +29,23 @@
*/
struct aiocb {
- int aio_fildes;
- void *aio_buf;
+ int aio_fildes;
+ void *aio_buf;
- off_t aio_offset;
- size_t aio_nbytes;
+ off64_t aio_offset;
+ size_t aio_nbytes;
- // Used internally
- std::thread thread;
- ssize_t ret;
- int error;
+ // Used internally
+ bool read;
+ bool queued;
+ ssize_t ret;
+ int error;
- ~aiocb();
+ std::mutex lock;
+ std::condition_variable cv;
+
+ aiocb();
+ ~aiocb();
};
// Submit a request for IO to be completed
@@ -55,7 +61,7 @@
ssize_t aio_return(struct aiocb *);
// Helper method for setting aiocb members
-void aio_prepare(struct aiocb *, void*, size_t, off_t);
+void aio_prepare(struct aiocb *, void*, size_t, off64_t);
#endif // POSIXASYNCIO_H