From 2b8cd00ab5fa0c05b58b08b1262aed2b9400c77c Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Mon, 22 Dec 2008 17:00:15 +0100 Subject: [PATCH] yet another renaming. call it "Sync"... --- src/common/subsystemrunner.hpp | 2 +- src/lib/Makefile.am | 2 +- src/lib/allocationcluster.cpp | 12 ++++++------ src/lib/allocationcluster.hpp | 4 ++-- src/lib/singletonpolicies.hpp | 4 ++-- src/lib/{concurrency.hpp => sync.hpp} | 14 +++++++------- src/lib/visitordispatcher.hpp | 8 ++++---- src/proc/assetmanager.cpp | 6 +++--- src/proc/mobject/session/defsregistry.hpp | 6 +++--- tests/lib/Makefile.am | 1 + ...ency-locking-test.cpp => sync-locking-test.cpp} | 12 ++++++------ 11 files changed, 36 insertions(+), 35 deletions(-) rename src/lib/{concurrency.hpp => sync.hpp} (95%) rename tests/lib/{concurrency-locking-test.cpp => sync-locking-test.cpp} (95%) diff --git a/src/common/subsystemrunner.hpp b/src/common/subsystemrunner.hpp index ca81d1686..3b565de83 100644 --- a/src/common/subsystemrunner.hpp +++ b/src/common/subsystemrunner.hpp @@ -27,7 +27,7 @@ #include "include/error.hpp" #include "lib/util.hpp" #include "common/subsys.hpp" -#include "lib/concurrency.hpp" +#include "lib/sync.hpp" #include #include diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 6460a0f88..c44284f86 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -68,7 +68,7 @@ noinst_HEADERS += \ $(liblumiera_la_srcdir)/visitor.hpp \ $(liblumiera_la_srcdir)/visitordispatcher.hpp \ $(liblumiera_la_srcdir)/visitorpolicies.hpp \ - $(liblumiera_la_srcdir)/concurrency.hpp \ + $(liblumiera_la_srcdir)/sync.hpp \ $(liblumiera_la_srcdir)/p.hpp \ $(liblumiera_la_srcdir)/query.hpp \ $(liblumiera_la_srcdir)/singletonfactory.hpp \ diff --git a/src/lib/allocationcluster.cpp b/src/lib/allocationcluster.cpp index 06982df51..b5eb022ef 100644 --- a/src/lib/allocationcluster.cpp +++ b/src/lib/allocationcluster.cpp @@ -81,7 +81,7 @@ namespace lib { void AllocationCluster::MemoryManager::reset (TypeInfo info) { - Concurrency::ClassLock guard(); + Sync::ClassLock guard(); if (0 < mem_.size()) purge(); type_ = info; @@ -96,7 +96,7 @@ namespace lib { void AllocationCluster::MemoryManager::purge() { - Concurrency::ClassLock guard(); + Sync::ClassLock guard(); REQUIRE (type_.killIt, "we need a deleter function"); REQUIRE (0 < type_.allocSize, "allocation size unknown"); @@ -120,7 +120,7 @@ namespace lib { inline void* AllocationCluster::MemoryManager::allocate() { - Concurrency::ClassLock guard(); + Sync::ClassLock guard(); REQUIRE (0 < type_.allocSize); REQUIRE (top_ <= mem_.size()); @@ -140,7 +140,7 @@ namespace lib { inline void AllocationCluster::MemoryManager::commit (void* pendingAlloc) { - Concurrency::ClassLock guard(); + Sync::ClassLock guard(); REQUIRE (pendingAlloc); ASSERT (top_ < mem_.size()); @@ -175,7 +175,7 @@ namespace lib { { try { - Concurrency::ClassLock guard(); + Sync::ClassLock guard(); TRACE (memory, "shutting down AllocationCluster"); for (size_t i = typeHandlers_.size(); 0 < i; --i) @@ -214,7 +214,7 @@ namespace lib { ASSERT (0 < slot); { - Concurrency::ClassLock guard(); /////TODO: decide tradeoff: lock just the instance, or lock the AllocationCluster class? + Sync::ClassLock guard(); /////TODO: decide tradeoff: lock just the instance, or lock the AllocationCluster class? if (slot > typeHandlers_.size()) typeHandlers_.resize(slot); diff --git a/src/lib/allocationcluster.hpp b/src/lib/allocationcluster.hpp index dd7ce8959..1e63732cc 100644 --- a/src/lib/allocationcluster.hpp +++ b/src/lib/allocationcluster.hpp @@ -52,7 +52,7 @@ #include #include "include/error.hpp" -#include "lib/concurrency.hpp" +#include "lib/sync.hpp" #include "lib/scopedholder.hpp" #include "lib/scopedholdertransfer.hpp" @@ -222,7 +222,7 @@ namespace lib { static TypeInfo setup() { - Concurrency::ClassLock guard(); + Sync::ClassLock guard(); if (!id_) id_= ++maxTypeIDs; diff --git a/src/lib/singletonpolicies.hpp b/src/lib/singletonpolicies.hpp index afbb87253..d0bade0e1 100644 --- a/src/lib/singletonpolicies.hpp +++ b/src/lib/singletonpolicies.hpp @@ -34,7 +34,7 @@ This code is heavily inspired by #ifndef LUMIERA_SINGLETONPOLICIES_H #define LUMIERA_SINGLETONPOLICIES_H -#include "lib/concurrency.hpp" +#include "lib/sync.hpp" #include "include/error.hpp" #include @@ -139,7 +139,7 @@ namespace lumiera struct Multithreaded { typedef volatile S VolatileType; - typedef lib::Concurrency::ClassLock Lock; + typedef lib::Sync::ClassLock Lock; }; diff --git a/src/lib/concurrency.hpp b/src/lib/sync.hpp similarity index 95% rename from src/lib/concurrency.hpp rename to src/lib/sync.hpp index d54952988..123bb06c7 100644 --- a/src/lib/concurrency.hpp +++ b/src/lib/sync.hpp @@ -21,7 +21,7 @@ */ -/** @file concurrency.hpp +/** @file sync.hpp ** Collection of helpers and wrappers to support dealing with concurrency issues. ** Actually, everything is implemented either by the Lumiera backend, or directly ** by pthread. The purpose is to support and automate the most common use cases @@ -95,7 +95,7 @@ namespace lib { * * @todo actually implement this facility using the Lumiera backend. */ - struct Concurrency + struct Sync { struct Monitor { @@ -114,7 +114,7 @@ namespace lib { template static inline Monitor& getMonitor(); - static inline Monitor& getMonitor(Concurrency* forThis); + static inline Monitor& getMonitor(Sync* forThis); class Lock @@ -150,16 +150,16 @@ namespace lib { - Concurrency::Monitor& - Concurrency::getMonitor(Concurrency* forThis) + Sync::Monitor& + Sync::getMonitor(Sync* forThis) { REQUIRE (forThis); return forThis->objectMonitor_; } template - Concurrency::Monitor& - Concurrency::getMonitor() + Sync::Monitor& + Sync::getMonitor() { //TODO: a rather obscure race condition is hidden here: //TODO: depending on the build order, the dtor of this static variable may be called, while another thread is still holding an ClassLock. diff --git a/src/lib/visitordispatcher.hpp b/src/lib/visitordispatcher.hpp index de56445b9..7977d7003 100644 --- a/src/lib/visitordispatcher.hpp +++ b/src/lib/visitordispatcher.hpp @@ -26,7 +26,7 @@ #define LUMIERA_VISITORDISPATCHER_H #include "include/error.hpp" -#include "lib/concurrency.hpp" +#include "lib/sync.hpp" #include "lib/singleton.hpp" #include "lib/util.hpp" @@ -36,7 +36,7 @@ namespace lumiera { namespace visitor { - using lib::Concurrency; + using lib::Sync; template class Tag; @@ -62,7 +62,7 @@ namespace lumiera { static void generateID (size_t& id) { - Concurrency::ClassLock guard(); + Sync::ClassLock guard(); if (!id) id = ++lastRegisteredID; } @@ -138,7 +138,7 @@ namespace lumiera { void accomodate (size_t index) { - Concurrency::ClassLock guard(); + Sync::ClassLock guard(); if (index > table_.size()) table_.resize (index); // performance bottleneck?? TODO: measure the real impact! } diff --git a/src/proc/assetmanager.cpp b/src/proc/assetmanager.cpp index 24b39dfbc..960699189 100644 --- a/src/proc/assetmanager.cpp +++ b/src/proc/assetmanager.cpp @@ -24,7 +24,7 @@ #include "proc/assetmanager.hpp" #include "proc/asset/db.hpp" -#include "lib/concurrency.hpp" +#include "lib/sync.hpp" #include "lib/util.hpp" #include @@ -39,7 +39,7 @@ using boost::bind; using util::for_each; using lumiera::Singleton; -using lib::Concurrency; +using lib::Sync; namespace asset @@ -116,7 +116,7 @@ namespace asset TODO ("check validity of Ident Category"); ID asset_id (getID (idi)); - Concurrency::ClassLock guard(); + Sync::ClassLock guard(); TODO ("handle duplicate Registrations"); P smart_ptr (obj, &destroy); diff --git a/src/proc/mobject/session/defsregistry.hpp b/src/proc/mobject/session/defsregistry.hpp index 8a3fcdfd5..ad4721b04 100644 --- a/src/proc/mobject/session/defsregistry.hpp +++ b/src/proc/mobject/session/defsregistry.hpp @@ -40,7 +40,7 @@ #define MOBJECT_SESSION_DEFSREGISTRY_H -#include "lib/concurrency.hpp" +#include "lib/sync.hpp" #include "lib/query.hpp" #include "lib/util.hpp" #include "lib/p.hpp" @@ -58,7 +58,7 @@ namespace mobject { using lumiera::P; using lumiera::Query; - using lib::Concurrency; + using lib::Sync; using std::tr1::weak_ptr; using std::string; @@ -162,7 +162,7 @@ namespace mobject { static void createSlot (Table& table) { - Concurrency::ClassLock guard(); + Sync::ClassLock guard(); if (!index) index = ++maxSlots; if (index > table.size()) diff --git a/tests/lib/Makefile.am b/tests/lib/Makefile.am index b1366bf3f..19a13ce2f 100644 --- a/tests/lib/Makefile.am +++ b/tests/lib/Makefile.am @@ -58,6 +58,7 @@ test_lib_SOURCES = \ $(testlib_srcdir)/singletontestmocktest.cpp \ $(testlib_srcdir)/streamtypebasicstest.cpp \ $(testlib_srcdir)/streamtypelifecycletest.cpp \ + $(testlib_srcdir)/sync-locking-test.cpp \ $(testlib_srcdir)/test/cmdlinewrappertest.cpp \ $(testlib_srcdir)/test/testoptiontest.cpp \ $(testlib_srcdir)/vectortransfertest.cpp \ diff --git a/tests/lib/concurrency-locking-test.cpp b/tests/lib/sync-locking-test.cpp similarity index 95% rename from tests/lib/concurrency-locking-test.cpp rename to tests/lib/sync-locking-test.cpp index 32f1eb744..884b030e7 100644 --- a/tests/lib/concurrency-locking-test.cpp +++ b/tests/lib/sync-locking-test.cpp @@ -1,5 +1,5 @@ /* - ConcurrencyLocking(Test) - check the monitor object based locking + SyncLocking(Test) - check the monitor object based locking Copyright (C) Lumiera.org 2008, Hermann Vosseler @@ -24,7 +24,7 @@ #include "lib/test/run.hpp" #include "include/error.hpp" -#include "lib/concurrency.hpp" +#include "lib/sync.hpp" #include @@ -48,7 +48,7 @@ namespace lib { class Victim - : public Concurrency + : public Sync { volatile long cnt_[NUM_COUNTERS]; volatile uint step_; ///< @note stored as instance variable @@ -166,9 +166,9 @@ namespace lib { * But because the class Victim uses an object level monitor to * guard the mutations, the state should remain consistent. * - * @see concurrency.hpp + * @see sync.hpp */ - class ConcurrencyLocking_test : public Test + class SyncLocking_test : public Test { virtual void @@ -198,7 +198,7 @@ namespace lib { /** Register this test class... */ - LAUNCHER (ConcurrencyLocking_test, "unit common"); + LAUNCHER (SyncLocking_test, "unit common");