rename class Thread into Concurrency

it's not a thread abstraction, but a locking helper
This commit is contained in:
Fischlurch 2008-12-15 04:14:15 +01:00
parent ee4c910ed4
commit d1e385f3f4
10 changed files with 35 additions and 36 deletions

View file

@ -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 \

View file

@ -81,7 +81,7 @@ namespace lib {
void
AllocationCluster::MemoryManager::reset (TypeInfo info)
{
Thread::Lock<MemoryManager> guard SIDEEFFECT;
Concurrency::Lock<MemoryManager> guard SIDEEFFECT;
if (0 < mem_.size()) purge();
type_ = info;
@ -96,7 +96,7 @@ namespace lib {
void
AllocationCluster::MemoryManager::purge()
{
Thread::Lock<MemoryManager> guard SIDEEFFECT;
Concurrency::Lock<MemoryManager> 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<MemoryManager> guard SIDEEFFECT;
Concurrency::Lock<MemoryManager> 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<MemoryManager> guard SIDEEFFECT;
Concurrency::Lock<MemoryManager> guard SIDEEFFECT;
REQUIRE (pendingAlloc);
ASSERT (top_ < mem_.size());
@ -175,7 +175,7 @@ namespace lib {
{
try
{
Thread::Lock<AllocationCluster> guard SIDEEFFECT
Concurrency::Lock<AllocationCluster> 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<AllocationCluster> guard SIDEEFFECT; /////TODO: decide tradeoff: lock just the instance, or lock the AllocationCluster class?
Concurrency::Lock<AllocationCluster> guard SIDEEFFECT; /////TODO: decide tradeoff: lock just the instance, or lock the AllocationCluster class?
if (slot > typeHandlers_.size())
typeHandlers_.resize(slot);

View file

@ -51,8 +51,8 @@
#include <boost/scoped_ptr.hpp>
#include <boost/noncopyable.hpp>
#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<AllocationCluster> guard SIDEEFFECT;
Concurrency::Lock<AllocationCluster> guard SIDEEFFECT;
if (!id_)
id_= ++maxTypeIDs;

View file

@ -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 <ct@pipapo.org>
@ -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 X>
class Lock

View file

@ -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 <vector>
@ -139,7 +139,7 @@ namespace lumiera
struct Multithreaded
{
typedef volatile S VolatileType;
typedef lumiera::Thread::Lock<S> Lock;
typedef lumiera::Concurrency::Lock<S> Lock;
};

View file

@ -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 <vector>
@ -62,7 +62,7 @@ namespace lumiera
static void
generateID (size_t& id)
{
Thread::Lock<Tag> guard SIDEEFFECT;
Concurrency::Lock<Tag> guard SIDEEFFECT;
if (!id)
id = ++lastRegisteredID;
}
@ -138,7 +138,7 @@ namespace lumiera
void
accomodate (size_t index)
{
Thread::Lock<Dispatcher> guard SIDEEFFECT;
Concurrency::Lock<Dispatcher> guard SIDEEFFECT;
if (index > table_.size())
table_.resize (index); // performance bottleneck?? TODO: measure the real impact!
}

View file

@ -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 <boost/function.hpp>
@ -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<KIND> asset_id (getID (idi));
Thread::Lock<DB> guard SIDEEFFECT;
Concurrency::Lock<DB> guard SIDEEFFECT;
TODO ("handle duplicate Registrations");
P<KIND> smart_ptr (obj, &destroy);

View file

@ -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<TableEntry> guard SIDEEFFECT;
Concurrency::Lock<TableEntry> guard SIDEEFFECT;
if (!index)
index = ++maxSlots;
if (index > table.size())

View file

@ -158,6 +158,11 @@ return: 0
END
PLANNED "Multithread Locking by Monitor" ConcurrencyLocking_test <<END
return: 0
END
TEST "CustomSharedPtr_test" CustomSharedPtr_test <<END
return: 0
END
@ -220,11 +225,6 @@ return: 0
END
PLANNED "Multithread Locking by Monitor" MultithreadLocking_test <<END
return: 0
END
TEST "RemoveFromSet_test" RemoveFromSet_test <<END
out: removed nothing ---> [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ]
out: removed 0 ---> [ 1, 2, 3, 4, 5, 6, 7, 8, 9, ]

View file

@ -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 <Ichthyostega@web.de>
@ -25,7 +25,7 @@
//#include "common/util.hpp"
#include "common/error.hpp"
#include "common/multithread.hpp"
#include "common/concurrency.hpp"
#include <glibmm.h>
@ -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");