aboutsummaryrefslogtreecommitdiff
path: root/odb/details/lock.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-09-03 16:20:38 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-09-03 16:20:38 +0200
commit0e2ae18a97fd507bac872031888d34c3a7d8b17b (patch)
tree3f9a551486969d2bc05f272e2da372c1a55d34cf /odb/details/lock.hxx
parent137b1eb3e41578d9d4a066ef75c6abfa597c46cd (diff)
Implement Win32 TLS support
Diffstat (limited to 'odb/details/lock.hxx')
-rw-r--r--odb/details/lock.hxx17
1 files changed, 8 insertions, 9 deletions
diff --git a/odb/details/lock.hxx b/odb/details/lock.hxx
index 7902d77..b479f28 100644
--- a/odb/details/lock.hxx
+++ b/odb/details/lock.hxx
@@ -18,30 +18,29 @@ namespace odb
struct LIBODB_EXPORT lock
{
lock (mutex& m)
- : mutex_ (m), locked_ (true)
+ : mutex_ (&m)
{
- mutex_.lock ();
+ mutex_->lock ();
}
~lock ()
{
- if (locked_)
- mutex_.unlock ();
+ if (mutex_ != 0)
+ mutex_->unlock ();
}
void
unlock ()
{
- if (locked_)
+ if (mutex_ != 0)
{
- mutex_.unlock ();
- locked_ = true;
+ mutex_->unlock ();
+ mutex_ = 0;
}
}
private:
- mutex& mutex_;
- bool locked_;
+ mutex* mutex_;
};
}
}