yet another renaming. call it "Sync"...

This commit is contained in:
Fischlurch 2008-12-22 17:00:15 +01:00
parent 67e95884d5
commit 2b8cd00ab5
11 changed files with 36 additions and 35 deletions

View file

@ -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 <tr1/functional>
#include <vector>

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)/concurrency.hpp \
$(liblumiera_la_srcdir)/sync.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)
{
Concurrency::ClassLock<MemoryManager> guard();
Sync::ClassLock<MemoryManager> guard();
if (0 < mem_.size()) purge();
type_ = info;
@ -96,7 +96,7 @@ namespace lib {
void
AllocationCluster::MemoryManager::purge()
{
Concurrency::ClassLock<MemoryManager> guard();
Sync::ClassLock<MemoryManager> 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<MemoryManager> guard();
Sync::ClassLock<MemoryManager> guard();
REQUIRE (0 < type_.allocSize);
REQUIRE (top_ <= mem_.size());
@ -140,7 +140,7 @@ namespace lib {
inline void
AllocationCluster::MemoryManager::commit (void* pendingAlloc)
{
Concurrency::ClassLock<MemoryManager> guard();
Sync::ClassLock<MemoryManager> guard();
REQUIRE (pendingAlloc);
ASSERT (top_ < mem_.size());
@ -175,7 +175,7 @@ namespace lib {
{
try
{
Concurrency::ClassLock<AllocationCluster> guard();
Sync::ClassLock<AllocationCluster> 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<AllocationCluster> guard(); /////TODO: decide tradeoff: lock just the instance, or lock the AllocationCluster class?
Sync::ClassLock<AllocationCluster> guard(); /////TODO: decide tradeoff: lock just the instance, or lock the AllocationCluster class?
if (slot > typeHandlers_.size())
typeHandlers_.resize(slot);

View file

@ -52,7 +52,7 @@
#include <boost/noncopyable.hpp>
#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<AllocationCluster> guard();
Sync::ClassLock<AllocationCluster> guard();
if (!id_)
id_= ++maxTypeIDs;

View file

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

View file

@ -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<class X>
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<class X>
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.

View file

@ -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 TOOL> class Tag;
@ -62,7 +62,7 @@ namespace lumiera {
static void
generateID (size_t& id)
{
Concurrency::ClassLock<Tag> guard();
Sync::ClassLock<Tag> guard();
if (!id)
id = ++lastRegisteredID;
}
@ -138,7 +138,7 @@ namespace lumiera {
void
accomodate (size_t index)
{
Concurrency::ClassLock<Dispatcher> guard();
Sync::ClassLock<Dispatcher> guard();
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/concurrency.hpp"
#include "lib/sync.hpp"
#include "lib/util.hpp"
#include <boost/function.hpp>
@ -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<KIND> asset_id (getID (idi));
Concurrency::ClassLock<DB> guard();
Sync::ClassLock<DB> guard();
TODO ("handle duplicate Registrations");
P<KIND> smart_ptr (obj, &destroy);

View file

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

View file

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

View file

@ -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 <Ichthyostega@web.de>
@ -24,7 +24,7 @@
#include "lib/test/run.hpp"
#include "include/error.hpp"
#include "lib/concurrency.hpp"
#include "lib/sync.hpp"
#include <glibmm.h>
@ -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");