From 42c2917d2093673a8ca4658d6d800d9b2d8ee4ee Mon Sep 17 00:00:00 2001 From: Tor Brede Vekterli Date: Tue, 27 Apr 2021 13:28:47 +0000 Subject: Add DistributorStripe thread pool with thread park/unpark support To enable safe and well-defined access to underlying stripe data structures from the main distributor thread, the pool has functionality for "parking" and "unparking" all stripe threads: * Parking makes all threads go into a blocked holding pattern where it is guaranteed that they may not race with any other threads. * Unparking releases all threads from their holding pattern, allowing them to continue their event processing loop. Also adds a custom run loop for distributor threads that largely emulates the waiting semantics found in the current framework ticking thread pool run loop. But unlike the framework pool, there is no global mutex that must be acquired by all threads in the pool. All stripe event handling uses per-thread mutexes and condition variables. Global state is only accessed when thread parking is requested, which happens very rarely. --- staging_vespalib/src/vespa/vespalib/util/document_runnable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'staging_vespalib') diff --git a/staging_vespalib/src/vespa/vespalib/util/document_runnable.cpp b/staging_vespalib/src/vespa/vespalib/util/document_runnable.cpp index e9e5cbbf953..53fe3c8a1d0 100644 --- a/staging_vespalib/src/vespa/vespalib/util/document_runnable.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/document_runnable.cpp @@ -26,7 +26,7 @@ bool Runnable::start(FastOS_ThreadPool& pool) if (_state != NOT_RUNNING) return false; _state = STARTING; if (pool.NewThread(this) == nullptr) { - throw vespalib::IllegalStateException("Faled starting a new thread", VESPA_STRLOC); + throw vespalib::IllegalStateException("Failed starting a new thread", VESPA_STRLOC); } return true; } -- cgit v1.2.3