summaryrefslogtreecommitdiff
path: root/src/session.h
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.h
parentf9f24fab933266ab8e12da7eef4cc2a906f77350 (diff)
downloadledger-c59018c29ddfc7a46aeb951fbcd5cb5b93f47ec0.tar.gz
ledger-c59018c29ddfc7a46aeb951fbcd5cb5b93f47ec0.tar.bz2
ledger-c59018c29ddfc7a46aeb951fbcd5cb5b93f47ec0.zip
Revised how commodities are dealt with.
Diffstat (limited to 'src/session.h')
-rw-r--r--src/session.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/session.h b/src/session.h
index 6fb2c21d..c8d83065 100644
--- a/src/session.h
+++ b/src/session.h
@@ -10,6 +10,8 @@ namespace ledger {
class session_t : public xml::xpath_t::scope_t
{
public:
+ static session_t * current;
+
path data_file;
optional<path> init_file;
optional<path> cache_file;
@@ -185,8 +187,16 @@ class session_t : public xml::xpath_t::scope_t
#endif
};
-void initialize();
-void shutdown();
+/**
+ * This sets the current session context, transferring all static
+ * globals to point at the data structures related to this session.
+ * Although Ledger itself is not thread-safe, by locking, switching
+ * session context, then unlocking after the operation is done,
+ * multiple threads can sequentially make use of the library. Thus, a
+ * session_t maintains all of the information relating to a single
+ * usage of the Ledger library.
+ */
+void set_session_context(session_t * session = NULL);
} // namespace ledger