From e3dafcdf8b43880c6a1e0451c8ee621f7c3cb954 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 16 Jan 2013 16:31:29 +0200 Subject: Make session cache management functions static, add notifications --- odb/session.cxx | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'odb/session.cxx') diff --git a/odb/session.cxx b/odb/session.cxx index 3ca6af4..0f18684 100644 --- a/odb/session.cxx +++ b/odb/session.cxx @@ -21,7 +21,7 @@ namespace odb if (has_current ()) throw already_in_session (); - current (*this); + current_pointer (this); } } @@ -30,14 +30,20 @@ namespace odb { // If we are the current thread's session, reset it. // - if (has_current () && ¤t () == this) + if (current_pointer () == this) reset_current (); } - bool session:: - has_current () + session* session:: + current_pointer () { - return tls_get (current_session) != 0; + return tls_get (current_session); + } + + void session:: + current_pointer (session* s) + { + tls_set (current_session, s); } session& session:: @@ -51,19 +57,6 @@ namespace odb return *cur; } - void session:: - current (session& s) - { - tls_set (current_session, &s); - } - - void session:: - reset_current () - { - session* s (0); - tls_set (current_session, s); - } - // // object_map_base // -- cgit v1.1