diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 4608feedb..6460a0f88 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)/multithread.hpp \ + $(liblumiera_la_srcdir)/concurrency.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 e30561952..20ae8ae0a 100644 --- a/src/lib/allocationcluster.cpp +++ b/src/lib/allocationcluster.cpp @@ -81,7 +81,7 @@ namespace lib { void AllocationCluster::MemoryManager::reset (TypeInfo info) { - Thread::Lock guard SIDEEFFECT; + Concurrency::Lock guard SIDEEFFECT; if (0 < mem_.size()) purge(); type_ = info; @@ -96,7 +96,7 @@ namespace lib { void AllocationCluster::MemoryManager::purge() { - Thread::Lock guard SIDEEFFECT; + Concurrency::Lock guard SIDEEFFECT; 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() { - Thread::Lock guard SIDEEFFECT; + Concurrency::Lock guard SIDEEFFECT; REQUIRE (0 < type_.allocSize); REQUIRE (top_ <= mem_.size()); @@ -140,7 +140,7 @@ namespace lib { inline void AllocationCluster::MemoryManager::commit (void* pendingAlloc) { - Thread::Lock guard SIDEEFFECT; + Concurrency::Lock guard SIDEEFFECT; REQUIRE (pendingAlloc); ASSERT (top_ < mem_.size()); @@ -175,7 +175,7 @@ namespace lib { { try { - Thread::Lock guard SIDEEFFECT + Concurrency::Lock guard SIDEEFFECT TRACE (memory, "shutting down AllocationCluster"); for (size_t i = typeHandlers_.size(); 0 < i; --i) @@ -214,7 +214,7 @@ namespace lib { ASSERT (0 < slot); { - Thread::Lock guard SIDEEFFECT; /////TODO: decide tradeoff: lock just the instance, or lock the AllocationCluster class? + Concurrency::Lock guard SIDEEFFECT; /////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 0e6a61a8d..ada15c501 100644 --- a/src/lib/allocationcluster.hpp +++ b/src/lib/allocationcluster.hpp @@ -51,8 +51,8 @@ #include #include -#include "lib/multithread.hpp" #include "include/error.hpp" +#include "lib/concurrency.hpp" #include "lib/scopedholder.hpp" #include "lib/scopedholdertransfer.hpp" @@ -60,7 +60,7 @@ namespace lib { using boost::scoped_ptr; - using lumiera::Thread; + using lumiera::Concurrency; /** * A pile of objects sharing common allocation and lifecycle. @@ -223,7 +223,7 @@ namespace lib { static TypeInfo setup() { - Thread::Lock guard SIDEEFFECT; + Concurrency::Lock guard SIDEEFFECT; if (!id_) id_= ++maxTypeIDs; diff --git a/src/lib/multithread.hpp b/src/lib/concurrency.hpp similarity index 93% rename from src/lib/multithread.hpp rename to src/lib/concurrency.hpp index 2d3b4b31f..f13f44711 100644 --- a/src/lib/multithread.hpp +++ b/src/lib/concurrency.hpp @@ -1,5 +1,5 @@ /* - MULTITHREAD.hpp - generic interface for multithreading primitives + CONCURRENCY.hpp - generic interface for multithreading primitives Copyright (C) Lumiera.org 2008, Christian Thaeter @@ -30,8 +30,7 @@ #include "lib/util.hpp" -namespace lumiera - { +namespace lumiera { /** * Interface/Policy for managing parallelism issues. @@ -40,7 +39,7 @@ namespace lumiera * * @todo actually implement this policy using the Lumiera databackend. */ - struct Thread + struct Concurrency { template class Lock diff --git a/src/lib/singletonpolicies.hpp b/src/lib/singletonpolicies.hpp index 572467264..25c174a58 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/multithread.hpp" +#include "lib/concurrency.hpp" #include "include/error.hpp" #include @@ -139,7 +139,7 @@ namespace lumiera struct Multithreaded { typedef volatile S VolatileType; - typedef lumiera::Thread::Lock Lock; + typedef lumiera::Concurrency::Lock Lock; }; diff --git a/src/lib/visitordispatcher.hpp b/src/lib/visitordispatcher.hpp index 857047aa5..5598b243c 100644 --- a/src/lib/visitordispatcher.hpp +++ b/src/lib/visitordispatcher.hpp @@ -26,9 +26,9 @@ #define LUMIERA_VISITORDISPATCHER_H #include "include/error.hpp" -#include "lib/util.hpp" +#include "lib/concurrency.hpp" #include "lib/singleton.hpp" -#include "lib/multithread.hpp" +#include "lib/util.hpp" #include @@ -62,7 +62,7 @@ namespace lumiera static void generateID (size_t& id) { - Thread::Lock guard SIDEEFFECT; + Concurrency::Lock guard SIDEEFFECT; if (!id) id = ++lastRegisteredID; } @@ -138,7 +138,7 @@ namespace lumiera void accomodate (size_t index) { - Thread::Lock guard SIDEEFFECT; + Concurrency::Lock guard SIDEEFFECT; 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 3c17421a9..9251ceaab 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/multithread.hpp" +#include "lib/concurrency.hpp" #include "lib/util.hpp" #include @@ -39,7 +39,7 @@ using boost::bind; using util::for_each; using lumiera::Singleton; -using lumiera::Thread; +using lumiera::Concurrency; namespace asset @@ -116,7 +116,7 @@ namespace asset TODO ("check validity of Ident Category"); ID asset_id (getID (idi)); - Thread::Lock guard SIDEEFFECT; + Concurrency::Lock guard SIDEEFFECT; 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 da79f40fa..89054de66 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/multithread.hpp" +#include "lib/concurrency.hpp" #include "lib/query.hpp" #include "lib/util.hpp" #include "lib/p.hpp" @@ -59,7 +59,7 @@ namespace mobject { using lumiera::P; using lumiera::Query; - using lumiera::Thread; + using lumiera::Concurrency; using std::tr1::weak_ptr; using std::string; @@ -163,7 +163,7 @@ namespace mobject static void createSlot (Table& table) { - Thread::Lock guard SIDEEFFECT; + Concurrency::Lock guard SIDEEFFECT; if (!index) index = ++maxSlots; if (index > table.size()) diff --git a/tests/40components.tests b/tests/40components.tests index c73e24eb1..c1bf07b0c 100644 --- a/tests/40components.tests +++ b/tests/40components.tests @@ -158,6 +158,11 @@ return: 0 END +PLANNED "Multithread Locking by Monitor" ConcurrencyLocking_test < [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ] out: removed 0 ---> [ 1, 2, 3, 4, 5, 6, 7, 8, 9, ] diff --git a/tests/common/multithread-locking-test.cpp b/tests/common/concurrency-locking-test.cpp similarity index 95% rename from tests/common/multithread-locking-test.cpp rename to tests/common/concurrency-locking-test.cpp index 465929e55..c55aac0bf 100644 --- a/tests/common/multithread-locking-test.cpp +++ b/tests/common/concurrency-locking-test.cpp @@ -1,5 +1,5 @@ /* - MultithreadLocking(Test) - check the monitor object based locking + ConcurrencyLocking(Test) - check the monitor object based locking Copyright (C) Lumiera.org 2008, Hermann Vosseler @@ -25,7 +25,7 @@ //#include "common/util.hpp" #include "common/error.hpp" -#include "common/multithread.hpp" +#include "common/concurrency.hpp" #include @@ -171,9 +171,9 @@ namespace lib { * But because the class Victim uses an object level monitor to * guard the mutations, the state should remain consistent. * - * @see multithread.hpp + * @see concurrency.hpp */ - class MultithreadLocking_test : public Test + class ConcurrencyLocking_test : public Test { virtual void run(Arg arg) @@ -202,7 +202,7 @@ namespace lib { /** Register this test class... */ - LAUNCHER (MultithreadLocking_test, "unit common"); + LAUNCHER (ConcurrencyLocking_test, "unit common");