aboutsummaryrefslogtreecommitdiff
path: root/odb/details/win32/once.ixx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/details/win32/once.ixx')
-rw-r--r--odb/details/win32/once.ixx18
1 files changed, 16 insertions, 2 deletions
diff --git a/odb/details/win32/once.ixx b/odb/details/win32/once.ixx
index 9f1706d..de46371 100644
--- a/odb/details/win32/once.ixx
+++ b/odb/details/win32/once.ixx
@@ -9,6 +9,19 @@ namespace odb
{
namespace details
{
+ inline void
+ win32_once (win32_once_t& o, void (*func) ())
+ {
+ win32_lock l (win32_once_cs_);
+
+ if (o == 0)
+ {
+ o = 1;
+ l.unlock ();
+ func ();
+ }
+ }
+
inline once::
once ()
: called_ (false)
@@ -18,12 +31,13 @@ namespace odb
inline void once::
call (void (*func) ())
{
- win32_lock l (cs_);
+ win32_lock l (win32_once_cs_);
if (!called_)
{
- func ();
called_ = true;
+ l.unlock ();
+ func ();
}
}
}