diff options
-rw-r--r-- | staging_vespalib/src/vespa/vespalib/util/document_runnable.cpp | 2 | ||||
-rw-r--r-- | storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.h | 8 |
2 files changed, 4 insertions, 6 deletions
diff --git a/staging_vespalib/src/vespa/vespalib/util/document_runnable.cpp b/staging_vespalib/src/vespa/vespalib/util/document_runnable.cpp index a612d5652ff..11fbf9d1655 100644 --- a/staging_vespalib/src/vespa/vespalib/util/document_runnable.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/document_runnable.cpp @@ -29,6 +29,7 @@ bool Runnable::stop() { vespalib::MonitorGuard monitor(_stateLock); if (_state == STOPPING || _state == NOT_RUNNING) return false; + while (_state == STARTING) monitor.wait(); GetThread()->SetBreakFlag(); _state = STOPPING; return onStop(); @@ -55,6 +56,7 @@ void Runnable::Run(FastOS_ThreadInterface*, void*) // called even though about to stop for consistency) if (_state == STARTING) { _state = RUNNING; + monitor.broadcast(); } } diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.h b/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.h index bdc491a5da6..798251f0573 100644 --- a/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.h +++ b/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.h @@ -49,12 +49,8 @@ class ThreadImpl : public Thread void run(); public: - ThreadImpl(ThreadPoolImpl&, - Runnable&, - vespalib::stringref id, - uint64_t waitTimeMs, - uint64_t maxProcessTimeMs, - int ticksBeforeWait); + ThreadImpl(ThreadPoolImpl&, Runnable&, vespalib::stringref id, uint64_t waitTimeMs, + uint64_t maxProcessTimeMs, int ticksBeforeWait); ~ThreadImpl(); bool interrupted() const override; |