|
Boost : |
Subject: Re: [boost] Boost library submission (poll for interest)
From: Stefan Strasser (strasser_at_[hidden])
Date: 2010-01-15 05:22:47
Am Friday 15 January 2010 13:50:43 schrieb Vicente Botet Escriba:
> > No. I should have at least used an auto there to ensure destruction.
> > Actually the whole convention of the "database as factory" for
> > transactions is something I'm going to rework so that you can have the
> > transaction on the stack if you so choose. I do think I want to
> > continue to support explicit transactions, but am very tempted by
> > something Stefan is doing in Boost.Persistent, in which transaction
> > scope is retained in thread-specific memory (I assume) and passed
> > around implicitly. Support for that as an optional approach is
> > something I need to do for those who prefer that.
>
> Hi,
> if you can store the transaction on the stack you could use the atomic
> language-like macros Stefan provides in it Persistent library.
>
> I agree that you should support transparent as well as explicit
> transactions. transparent transaction have a cost to access the thread
> specific pointer.
>
what happened to vicente's suggestion to unify this for all 3 libraries?
this is how you implement a resource manager with my library, but if we do
bring this together it obviously shouldn't be part of my library so there is
no dependency just for that.
user code:
int main(){
transaction tx;
mytransmap->insert(1);
tx.commit();
atomic{
mytransmap->insert(2);
}retry;
}
behind the scenes:
struct stldb_tag{};
class my_resource_manager{
typedef stldb::transaction transaction;
typedef stldb_tag tag;
void commit_transaction(transaction &tx){ stldb::commit(tx); }
void rollback_transaction(transaction &tx){ stldb::rollback(tx); }
...
};
typedef basic_transaction_manager<my_resource_manager>
stldb_transaction_manager;
#define BOOST_PERSISTENT_CONFIGURATION stldb_transaction_manager;
#include <boost/persistent/transaction_manager.hpp>
#include <boost/persistent/transaction.hpp>
class trans_map{
void insert(int){
stldb::transaction &tx=
transaction_manager::active().resoure_transaction<stldb_tag>();
//...do something with transaction
}
};
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk