From cfe072bd326ce8cacb038163fced9a8623039ac1 Mon Sep 17 00:00:00 2001 From: Rodolfo Ribeiro Gomes Date: Dec 06 2019 08:41:34 +0000 Subject: rename private mutex_ member to mutex --- diff --git a/synfig-core/src/modules/lyr_freetype/lyr_freetype.cpp b/synfig-core/src/modules/lyr_freetype/lyr_freetype.cpp index 49eee8b..581c8cd 100644 --- a/synfig-core/src/modules/lyr_freetype/lyr_freetype.cpp +++ b/synfig-core/src/modules/lyr_freetype/lyr_freetype.cpp @@ -481,7 +481,7 @@ Layer_Freetype::new_face(const String &newfont) bool Layer_Freetype::set_param(const String & param, const ValueBase &value) { - std::lock_guard lock(mutex_); + std::lock_guard lock(mutex); /* if(param=="font" && value.same_type_as(font)) { diff --git a/synfig-core/src/modules/lyr_freetype/lyr_freetype.h b/synfig-core/src/modules/lyr_freetype/lyr_freetype.h index bc9e4c3..8ce34b0 100644 --- a/synfig-core/src/modules/lyr_freetype/lyr_freetype.h +++ b/synfig-core/src/modules/lyr_freetype/lyr_freetype.h @@ -70,9 +70,6 @@ /* === C L A S S E S & S T R U C T S ======================================= */ using namespace synfig; -using namespace std; -using namespace etl; - struct Glyph { @@ -150,7 +147,7 @@ private: synfig::Color color_func(const synfig::Point &x, int quality=10, synfig::ColorReal supersample=0)const; - mutable std::mutex mutex_; + mutable std::mutex mutex; public: Layer_Freetype(); diff --git a/synfig-core/src/modules/mod_particle/plant.cpp b/synfig-core/src/modules/mod_particle/plant.cpp index 7221d48..614229b 100644 --- a/synfig-core/src/modules/mod_particle/plant.cpp +++ b/synfig-core/src/modules/mod_particle/plant.cpp @@ -223,7 +223,7 @@ Plant::sync()const int splits=param_splits.get(int()); bool use_width=param_use_width.get(bool()); - std::lock_guard lock(mutex_); + std::lock_guard lock(mutex); if (!needs_sync_) return; time_t start_time; time(&start_time); particle_list.clear(); diff --git a/synfig-core/src/modules/mod_particle/plant.h b/synfig-core/src/modules/mod_particle/plant.h index 08db880..6053e43 100644 --- a/synfig-core/src/modules/mod_particle/plant.h +++ b/synfig-core/src/modules/mod_particle/plant.h @@ -46,7 +46,6 @@ /* === C L A S S E S & S T R U C T S ======================================= */ using namespace synfig; -using namespace std; using namespace etl; class Plant : public Layer_Composite, public Layer_NoDeform @@ -104,7 +103,7 @@ private: Real mass; mutable bool needs_sync_; - mutable mutex mutex_; + mutable std::mutex mutex; void branch(int n, int depth,float t, float stunt_growth, Point position,Vector velocity)const; void sync()const; diff --git a/synfig-core/src/synfig/debug/log.cpp b/synfig-core/src/synfig/debug/log.cpp index 33cde88..c335285 100644 --- a/synfig-core/src/synfig/debug/log.cpp +++ b/synfig-core/src/synfig/debug/log.cpp @@ -53,11 +53,11 @@ using namespace debug; /* === M E T H O D S ======================================================= */ -std::mutex Log::mutex_; +std::mutex Log::mutex; void Log::append_line_to_file(const String &logfile, const String &str) { - std::lock_guard lock(mutex_); + std::lock_guard lock(mutex); std::ofstream f(logfile.c_str(), std::ios_base::app); f << str << std::endl; } diff --git a/synfig-core/src/synfig/debug/log.h b/synfig-core/src/synfig/debug/log.h index 272172b..65e196b 100644 --- a/synfig-core/src/synfig/debug/log.h +++ b/synfig-core/src/synfig/debug/log.h @@ -44,7 +44,7 @@ namespace debug { class Log { private: - static std::mutex mutex_; + static std::mutex mutex; public: diff --git a/synfig-core/src/synfig/layers/layer_bitmap.cpp b/synfig-core/src/synfig/layers/layer_bitmap.cpp index d8b0fae..ad6cf25 100644 --- a/synfig-core/src/synfig/layers/layer_bitmap.cpp +++ b/synfig-core/src/synfig/layers/layer_bitmap.cpp @@ -257,7 +257,7 @@ synfig::Layer_Bitmap::get_color(Context context, const Point &pos)const surface_pos[1]/=br[1]-tl[1]; if(surface_pos[1]<=1.0 && surface_pos[1]>=0.0) { - std::lock_guard lock(mutex_); + std::lock_guard lock(mutex); if (trimmed) { @@ -364,7 +364,7 @@ Layer_Bitmap::accelerated_render(Context context,Surface *surface,int quality, c { RENDER_TRANSFORMED_IF_NEED(__FILE__, __LINE__) - std::lock_guard lock(mutex_); + std::lock_guard lock(mutex); Point tl(param_tl.get(Point())); Point br(param_br.get(Point())); diff --git a/synfig-core/src/synfig/layers/layer_bitmap.h b/synfig-core/src/synfig/layers/layer_bitmap.h index ff98b7a..3071206 100644 --- a/synfig-core/src/synfig/layers/layer_bitmap.h +++ b/synfig-core/src/synfig/layers/layer_bitmap.h @@ -60,7 +60,7 @@ public: ValueBase param_c; ValueBase param_gamma_adjust; - mutable std::mutex mutex_; + mutable std::mutex mutex; mutable rendering::software::PackedSurface::Reader reader; mutable rendering::SurfaceResource::Handle rendering_surface; mutable bool trimmed; diff --git a/synfig-core/src/synfig/layers/layer_duplicate.cpp b/synfig-core/src/synfig/layers/layer_duplicate.cpp index 251f8a2..edd58ce 100644 --- a/synfig-core/src/synfig/layers/layer_duplicate.cpp +++ b/synfig-core/src/synfig/layers/layer_duplicate.cpp @@ -121,7 +121,7 @@ Layer_Duplicate::get_color(Context context, const Point &pos)const float amount(get_amount()); Color color; - std::lock_guard lock(mutex_); + std::lock_guard lock(mutex); Time time_cur = get_time_mark(); duplicate_param->reset_index(time_cur); do @@ -187,7 +187,7 @@ Layer_Duplicate::accelerated_render(Context context,Surface *surface,int quality Time time_cur = get_time_mark(); int steps = duplicate_param->count_steps(time_cur); - std::lock_guard lock(mutex_); + std::lock_guard lock(mutex); duplicate_param->reset_index(time_cur); do { @@ -233,7 +233,7 @@ Layer_Duplicate::accelerated_cairorender(Context context, cairo_t *cr, int quali Time time_cur = get_time_mark(); int steps = duplicate_param->count_steps(time_cur); - std::lock_guard lock(mutex_); + std::lock_guard lock(mutex); duplicate_param->reset_index(time_cur); cairo_save(cr); do @@ -269,7 +269,7 @@ Layer_Duplicate::build_rendering_task_vfunc(Context context) const rendering::Task::Handle task; - std::lock_guard lock(mutex_); + std::lock_guard lock(mutex); duplicate_param->reset_index(time_cur); do { diff --git a/synfig-core/src/synfig/layers/layer_duplicate.h b/synfig-core/src/synfig/layers/layer_duplicate.h index 15caeff..6701574 100644 --- a/synfig-core/src/synfig/layers/layer_duplicate.h +++ b/synfig-core/src/synfig/layers/layer_duplicate.h @@ -42,7 +42,7 @@ class Layer_Duplicate : public synfig::Layer_CompositeFork private: mutable ValueBase param_index; - mutable std::mutex mutex_; + mutable std::mutex mutex; public: diff --git a/synfig-core/src/synfig/main.cpp b/synfig-core/src/synfig/main.cpp index 0cef8ec..bae475f 100644 --- a/synfig-core/src/synfig/main.cpp +++ b/synfig-core/src/synfig/main.cpp @@ -86,7 +86,6 @@ #define PATH_MAX 4096 #endif -using namespace std; using namespace etl; using namespace synfig; @@ -101,13 +100,13 @@ Main *Main::instance = NULL; class GeneralIOMutexHolder { private: - mutex mutex_; + std::mutex mutex; bool initialized; public: GeneralIOMutexHolder(): initialized(true) { } ~GeneralIOMutexHolder() { initialized = false; } - void lock() { if (initialized) mutex_.lock(); } - void unlock() { if (initialized) mutex_.unlock(); } + void lock() { if (initialized) mutex.lock(); } + void unlock() { if (initialized) mutex.unlock(); } }; GeneralIOMutexHolder general_io_mutex; @@ -447,7 +446,7 @@ void synfig::error(const String &str) { general_io_mutex.lock(); - cerr<<"\033[31m"<<"synfig("< Map; private: - std::mutex mutex_; + std::mutex mutex; Map map; public: Node* get(const GUID &guid) { - std::lock_guard lock(mutex_); + std::lock_guard lock(mutex); Map::iterator i = map.find(guid); return i == map.end() ? nullptr : i->second; } @@ -86,7 +86,7 @@ namespace { assert(guid); assert(node); - std::lock_guard lock(mutex_); + std::lock_guard lock(mutex); assert(!map.count(guid)); map[guid] = node; } @@ -95,7 +95,7 @@ namespace { assert(guid); assert(node); - std::lock_guard lock(mutex_); + std::lock_guard lock(mutex); Map::iterator i = map.find(guid); assert(i != map.end() && i->second == node); map.erase(i); @@ -110,7 +110,7 @@ namespace { } assert(oldguid); - std::lock_guard lock(mutex_); + std::lock_guard lock(mutex); Map::iterator i = map.find(oldguid); assert(i != map.end() && i->second == node); map.erase(i); diff --git a/synfig-core/src/synfig/rendering/software/function/packedsurface.cpp b/synfig-core/src/synfig/rendering/software/function/packedsurface.cpp index 11de59e..4843126 100644 --- a/synfig-core/src/synfig/rendering/software/function/packedsurface.cpp +++ b/synfig-core/src/synfig/rendering/software/function/packedsurface.cpp @@ -89,7 +89,7 @@ PackedSurface::Reader::open(const PackedSurface &surface) { this->surface = &surface; - std::lock_guard lock(surface.mutex_); + std::lock_guard lock(surface.mutex); surface.readers.insert(this); } @@ -120,7 +120,7 @@ PackedSurface::Reader::close() if (is_opened()) { { - std::lock_guard lock(surface->mutex_); + std::lock_guard lock(surface->mutex); surface->readers.erase(this); } if (cache) delete[] cache; diff --git a/synfig-core/src/synfig/rendering/software/function/packedsurface.h b/synfig-core/src/synfig/rendering/software/function/packedsurface.h index ce5ed5a..72e5c7e 100644 --- a/synfig-core/src/synfig/rendering/software/function/packedsurface.h +++ b/synfig-core/src/synfig/rendering/software/function/packedsurface.h @@ -128,7 +128,7 @@ public: typedef etl::sampler Sampler; private: - mutable std::mutex mutex_; + mutable std::mutex mutex; mutable std::set readers; int width; diff --git a/synfig-studio/src/synfigapp/actions/layerpaint.cpp b/synfig-studio/src/synfigapp/actions/layerpaint.cpp index b44fd25..5972d8a 100644 --- a/synfig-studio/src/synfigapp/actions/layerpaint.cpp +++ b/synfig-studio/src/synfigapp/actions/layerpaint.cpp @@ -154,7 +154,7 @@ Action::LayerPaint::PaintStroke::add_point_and_apply(const PaintPoint &point) int w = wrapper.surface->get_w(); int h = wrapper.surface->get_h(); { - std::lock_guard lock(layer->mutex_); + std::lock_guard lock(layer->mutex); brush_.stroke_to(&wrapper, point.x, point.y, point.pressure, 0.f, 0.f, point.dtime); // fix state in case of surface resized @@ -219,7 +219,7 @@ Action::LayerPaint::PaintStroke::undo() assert(prepared); if (!applied) return; { - std::lock_guard lock(layer->mutex_); + std::lock_guard lock(layer->mutex); Surface *surface = new Surface(); paint_prev(*surface); layer->rendering_surface = new rendering::SurfaceResource( @@ -237,7 +237,7 @@ Action::LayerPaint::PaintStroke::apply() assert(prepared); if (applied) return; { - std::lock_guard lock(layer->mutex_); + std::lock_guard lock(layer->mutex); Surface *surface = new Surface(); paint_self(*surface); layer->rendering_surface = new rendering::SurfaceResource(