|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r84005 - trunk/libs/thread/test/sync/mutual_exclusion/once/call_once
From: vicente.botet_at_[hidden]
Date: 2013-04-21 12:39:04
Author: viboes
Date: 2013-04-21 12:39:04 EDT (Sun, 21 Apr 2013)
New Revision: 84005
URL: http://svn.boost.org/trac/boost/changeset/84005
Log:
Thread: Added call_once test with boost::ref().
Text files modified:
trunk/libs/thread/test/sync/mutual_exclusion/once/call_once/call_once_pass.cpp | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
Modified: trunk/libs/thread/test/sync/mutual_exclusion/once/call_once/call_once_pass.cpp
==============================================================================
--- trunk/libs/thread/test/sync/mutual_exclusion/once/call_once/call_once_pass.cpp (original)
+++ trunk/libs/thread/test/sync/mutual_exclusion/once/call_once/call_once_pass.cpp 2013-04-21 12:39:04 EDT (Sun, 21 Apr 2013)
@@ -190,8 +190,40 @@
}
};
+
+struct id_string
+{
+ static boost::once_flag flag;
+ static void do_init(id_string & )
+ {}
+ void operator()()
+ {
+ boost::call_once(flag, &id_string::do_init, boost::ref(*this));
+ }
+// void operator()(int,int)
+// {
+// // This should fail but works with gcc-4.6.3
+// //std::bind(&id_string::do_init, *this)();
+// std::bind(&id_string::do_init, std::ref(*this))();
+// }
+// void operator()(int) const
+// {
+// //std::bind(&id_string::do_init, *this)();
+// }
+};
+
+
+boost::once_flag id_string::flag BOOST_INIT_ONCE_INIT;
+
int main()
{
+
+ //
+ {
+ id_string id;
+ id();
+ //id(1,1);
+ }
// check basic functionality
{
boost::thread t0(f0);
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk