summaryrefslogtreecommitdiff
path: root/libutils/Threads.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-10-08 11:10:11 -0700
committerElliott Hughes <enh@google.com>2018-10-08 11:15:52 -0700
commit643268f325e2bda64248df24913f8b68c842c95a (patch)
tree4ddf6fdaa71ad280a6df08821c15ce97955a4c64 /libutils/Threads.cpp
parentf3186de123c742166ec5e61b27b61af3ef929dfb (diff)
Move system/core/ off NO_ERROR.
It causes trouble for Windows, and OK already exists. Bug: N/A Test: builds Change-Id: Ida22fd658b0ebb259c710ba39049b07c9e495d9c
Diffstat (limited to 'libutils/Threads.cpp')
-rw-r--r--libutils/Threads.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/libutils/Threads.cpp b/libutils/Threads.cpp
index 43ec6c139..64bc4025d 100644
--- a/libutils/Threads.cpp
+++ b/libutils/Threads.cpp
@@ -379,7 +379,7 @@ status_t Mutex::lock()
{
DWORD dwWaitResult;
dwWaitResult = WaitForSingleObject((HANDLE) mState, INFINITE);
- return dwWaitResult != WAIT_OBJECT_0 ? -1 : NO_ERROR;
+ return dwWaitResult != WAIT_OBJECT_0 ? -1 : OK;
}
void Mutex::unlock()
@@ -506,7 +506,7 @@ typedef struct WinCondition {
ReleaseMutex(condState->internalMutex);
WaitForSingleObject(hMutex, INFINITE);
- return res == WAIT_OBJECT_0 ? NO_ERROR : -1;
+ return res == WAIT_OBJECT_0 ? OK : -1;
}
} WinCondition;
@@ -639,13 +639,15 @@ void Condition::broadcast()
*/
Thread::Thread(bool canCallJava)
- : mCanCallJava(canCallJava),
- mThread(thread_id_t(-1)),
- mLock("Thread::mLock"),
- mStatus(NO_ERROR),
- mExitPending(false), mRunning(false)
+ : mCanCallJava(canCallJava),
+ mThread(thread_id_t(-1)),
+ mLock("Thread::mLock"),
+ mStatus(OK),
+ mExitPending(false),
+ mRunning(false)
#if defined(__ANDROID__)
- , mTid(-1)
+ ,
+ mTid(-1)
#endif
{
}
@@ -656,7 +658,7 @@ Thread::~Thread()
status_t Thread::readyToRun()
{
- return NO_ERROR;
+ return OK;
}
status_t Thread::run(const char* name, int32_t priority, size_t stack)
@@ -672,7 +674,7 @@ status_t Thread::run(const char* name, int32_t priority, size_t stack)
// reset status and exitPending to their default value, so we can
// try again after an error happened (either below, or in readyToRun())
- mStatus = NO_ERROR;
+ mStatus = OK;
mExitPending = false;
mThread = thread_id_t(-1);
@@ -700,10 +702,10 @@ status_t Thread::run(const char* name, int32_t priority, size_t stack)
}
// Do not refer to mStatus here: The thread is already running (may, in fact
- // already have exited with a valid mStatus result). The NO_ERROR indication
+ // already have exited with a valid mStatus result). The OK indication
// here merely indicates successfully starting the thread and does not
// imply successful termination/execution.
- return NO_ERROR;
+ return OK;
// Exiting scope of mLock is a memory barrier and allows new thread to run
}
@@ -728,7 +730,7 @@ int Thread::_threadLoop(void* user)
if (first) {
first = false;
self->mStatus = self->readyToRun();
- result = (self->mStatus == NO_ERROR);
+ result = (self->mStatus == OK);
if (result && !self->exitPending()) {
// Binder threads (and maybe others) rely on threadLoop