From 881e9fbad7af62d5f8f8fd6c42b12ef7c45e3bc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Fri, 3 Jul 2015 16:47:58 +0200 Subject: [PATCH] Use Guard alias and DEV_GUARDED macro in SmartVM. --- CodingStandards.txt | 3 +-- libevm/SmartVM.cpp | 11 ++++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/CodingStandards.txt b/CodingStandards.txt index 66a61f6ae..a065928d3 100644 --- a/CodingStandards.txt +++ b/CodingStandards.txt @@ -196,7 +196,7 @@ a. Prefer 'using' to 'typedef'. e.g. using ints = std::vector; rather than b. Generally avoid shortening a standard form that already includes all important information: - e.g. stick to shared_ptr rather than shortening to ptr. c. Where there are exceptions to this (due to excessive use and clear meaning), note the change prominently and use it consistently. -- e.g. using Guard = boost::lock_guard; ///< Guard is used throughout the codebase since it's clear in meaning and used commonly. +- e.g. using Guard = std::lock_guard; ///< Guard is used throughout the codebase since it's clear in meaning and used commonly. d. In general expressions should be roughly as important/semantically meaningful as the space they occupy. @@ -226,4 +226,3 @@ a. Includes should go in order of lower level (STL -> boost -> libdevcore -> lib #include b. The only exception to the above rule is the top of a .cpp file where its corresponding header should be located. - diff --git a/libevm/SmartVM.cpp b/libevm/SmartVM.cpp index fe1c9e346..add43302e 100644 --- a/libevm/SmartVM.cpp +++ b/libevm/SmartVM.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include "VMFactory.h" @@ -92,20 +93,16 @@ namespace ~JitWorker() { - { - std::lock_guard lock{x_mutex}; + DEV_GUARDED(x_mutex) m_finished = true; - } m_cv.notify_one(); m_worker.join(); } void push(JitTask&& _task) { - { - std::lock_guard lock(x_mutex); - m_queue.push(std::move(_task)); - } + DEV_GUARDED(x_mutex) + m_queue.push(std::move(_task)); m_cv.notify_one(); } };