Loading include/utils/Thread.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -45,7 +45,7 @@ public: virtual ~Thread(); virtual ~Thread(); // Start the thread in threadLoop() which needs to be implemented. // Start the thread in threadLoop() which needs to be implemented. virtual status_t run( const char* name = 0, virtual status_t run( const char* name, int32_t priority = PRIORITY_DEFAULT, int32_t priority = PRIORITY_DEFAULT, size_t stack = 0); size_t stack = 0); Loading libutils/Threads.cpp +2 −0 Original line number Original line Diff line number Diff line Loading @@ -668,6 +668,8 @@ status_t Thread::readyToRun() status_t Thread::run(const char* name, int32_t priority, size_t stack) status_t Thread::run(const char* name, int32_t priority, size_t stack) { { LOG_ALWAYS_FATAL_IF(name == nullptr, "thread name not provided to Thread::run"); Mutex::Autolock _l(mLock); Mutex::Autolock _l(mLock); if (mRunning) { if (mRunning) { Loading libutils/tests/Looper_test.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -138,7 +138,7 @@ TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndAwokenBeforeWaiting_Immediately TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndAwokenWhileWaiting_PromptlyReturns) { TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndAwokenWhileWaiting_PromptlyReturns) { sp<DelayedWake> delayedWake = new DelayedWake(100, mLooper); sp<DelayedWake> delayedWake = new DelayedWake(100, mLooper); delayedWake->run(); delayedWake->run("LooperTest"); StopWatch stopWatch("pollOnce"); StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(1000); int result = mLooper->pollOnce(1000); Loading Loading @@ -251,7 +251,7 @@ TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndSignalledFDWhileWaiting_Promptl sp<DelayedWriteSignal> delayedWriteSignal = new DelayedWriteSignal(100, & pipe); sp<DelayedWriteSignal> delayedWriteSignal = new DelayedWriteSignal(100, & pipe); handler.setCallback(mLooper, pipe.receiveFd, Looper::EVENT_INPUT); handler.setCallback(mLooper, pipe.receiveFd, Looper::EVENT_INPUT); delayedWriteSignal->run(); delayedWriteSignal->run("LooperTest"); StopWatch stopWatch("pollOnce"); StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(1000); int result = mLooper->pollOnce(1000); Loading Loading
include/utils/Thread.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -45,7 +45,7 @@ public: virtual ~Thread(); virtual ~Thread(); // Start the thread in threadLoop() which needs to be implemented. // Start the thread in threadLoop() which needs to be implemented. virtual status_t run( const char* name = 0, virtual status_t run( const char* name, int32_t priority = PRIORITY_DEFAULT, int32_t priority = PRIORITY_DEFAULT, size_t stack = 0); size_t stack = 0); Loading
libutils/Threads.cpp +2 −0 Original line number Original line Diff line number Diff line Loading @@ -668,6 +668,8 @@ status_t Thread::readyToRun() status_t Thread::run(const char* name, int32_t priority, size_t stack) status_t Thread::run(const char* name, int32_t priority, size_t stack) { { LOG_ALWAYS_FATAL_IF(name == nullptr, "thread name not provided to Thread::run"); Mutex::Autolock _l(mLock); Mutex::Autolock _l(mLock); if (mRunning) { if (mRunning) { Loading
libutils/tests/Looper_test.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -138,7 +138,7 @@ TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndAwokenBeforeWaiting_Immediately TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndAwokenWhileWaiting_PromptlyReturns) { TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndAwokenWhileWaiting_PromptlyReturns) { sp<DelayedWake> delayedWake = new DelayedWake(100, mLooper); sp<DelayedWake> delayedWake = new DelayedWake(100, mLooper); delayedWake->run(); delayedWake->run("LooperTest"); StopWatch stopWatch("pollOnce"); StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(1000); int result = mLooper->pollOnce(1000); Loading Loading @@ -251,7 +251,7 @@ TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndSignalledFDWhileWaiting_Promptl sp<DelayedWriteSignal> delayedWriteSignal = new DelayedWriteSignal(100, & pipe); sp<DelayedWriteSignal> delayedWriteSignal = new DelayedWriteSignal(100, & pipe); handler.setCallback(mLooper, pipe.receiveFd, Looper::EVENT_INPUT); handler.setCallback(mLooper, pipe.receiveFd, Looper::EVENT_INPUT); delayedWriteSignal->run(); delayedWriteSignal->run("LooperTest"); StopWatch stopWatch("pollOnce"); StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(1000); int result = mLooper->pollOnce(1000); Loading