diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-01-16 16:31:29 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-01-16 16:31:29 +0200 |
commit | e3dafcdf8b43880c6a1e0451c8ee621f7c3cb954 (patch) | |
tree | ab90ae868337a1c286ab9334c83e890cd0614686 /odb/session.cxx | |
parent | d2c1f5f1a3063553483d09dec261efa44c6bc9bf (diff) |
Make session cache management functions static, add notifications
Diffstat (limited to 'odb/session.cxx')
-rw-r--r-- | odb/session.cxx | 29 |
1 files changed, 11 insertions, 18 deletions
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 // |