summaryrefslogtreecommitdiff
path: root/src/session.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2007-05-03 06:11:04 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 03:38:36 -0400
commitc59018c29ddfc7a46aeb951fbcd5cb5b93f47ec0 (patch)
tree204d28bfa2bdbfe8d7f550877faa114c1e93859f /src/session.cc
parentf9f24fab933266ab8e12da7eef4cc2a906f77350 (diff)
downloadfork-ledger-c59018c29ddfc7a46aeb951fbcd5cb5b93f47ec0.tar.gz
fork-ledger-c59018c29ddfc7a46aeb951fbcd5cb5b93f47ec0.tar.bz2
fork-ledger-c59018c29ddfc7a46aeb951fbcd5cb5b93f47ec0.zip
Revised how commodities are dealt with.
Diffstat (limited to 'src/session.cc')
-rw-r--r--src/session.cc49
1 files changed, 37 insertions, 12 deletions
diff --git a/src/session.cc b/src/session.cc
index 5f452f25..d53faf09 100644
--- a/src/session.cc
+++ b/src/session.cc
@@ -2,6 +2,41 @@
namespace ledger {
+session_t * session_t::current = NULL;
+
+#if 0
+boost::mutex session_t::session_mutex;
+#endif
+
+static void initialize();
+static void shutdown();
+
+void set_session_context(session_t * session)
+{
+#if 0
+ session_t::session_mutex.lock();
+#endif
+
+ if (session && ! session_t::current) {
+ initialize();
+ }
+ else if (! session && session_t::current) {
+ shutdown();
+#if 0
+ session_t::session_mutex.unlock();
+#endif
+ }
+
+ session_t::current = session;
+}
+
+void release_session_context()
+{
+#if 0
+ session_t::session_mutex.unlock();
+#endif
+}
+
unsigned int session_t::read_journal(std::istream& in,
journal_t * journal,
account_t * master,
@@ -203,26 +238,16 @@ xml::xpath_t::op_t * session_t::lookup(const string& name)
// jww (2007-04-26): All of Ledger should be accessed through a
// session_t object
-void initialize()
+static void initialize()
{
- IF_VERIFY()
- initialize_memory_tracing();
-
amount_t::initialize();
xml::xpath_t::initialize();
}
-void shutdown()
+static void shutdown()
{
xml::xpath_t::shutdown();
amount_t::shutdown();
-
- IF_VERIFY() {
- INFO("Ledger ended (Boost/libstdc++ may still hold memory)");
- shutdown_memory_tracing();
- } else {
- INFO("Ledger ended");
- }
}
} // namespace ledger