}
void add(WorkItem item) {
- isc::util::thread::LockGuard<std::mutex> lock(&mutex_);
+ std::lock_guard<std::mutex> lock(mutex_);
if (exit_) {
return;
}
bool get(WorkItem& item) {
std::unique_lock<std::mutex> lock(mutex_);
-
while (!exit_) {
if (queue_.empty()) {
// Wait for add() or destroy().
}
size_t count() {
- isc::util::thread::LockGuard<std::mutex> lock(&mutex_);
+ std::lock_guard<std::mutex> lock(mutex_);
return queue_.size();
}
void removeAll() {
- isc::util::thread::LockGuard<std::mutex> lock(&mutex_);
+ std::lock_guard<std::mutex> lock(mutex_);
removeAllUnsafe();
}
void create() {
- isc::util::thread::LockGuard<std::mutex> lock(&mutex_);
+ std::lock_guard<std::mutex> lock(mutex_);
exit_ = false;
}
void destroy() {
- isc::util::thread::LockGuard<std::mutex> lock(&mutex_);
+ std::lock_guard<std::mutex> lock(mutex_);
exit_ = true;
// Notify get() so that it can exit.
cv_.notify_all();
+// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2019 Deutsche Telekom AG.
+//
+// Authors: Andrei Pavel <andrei.pavel@qualitance.com>
+// Cristian Secareanu <cristian.secareanu@qualitance.com>
+// Razvan Becheriu <razvan.becheriu@qualitance.com>
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// 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
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
#ifndef LOCK_GUARD_H
#define LOCK_GUARD_H