Revision: 670
http://assorted.svn.sourceforge.net/assorted/?rev=670&view=rev
Author: yangzhang
Date: 2008-04-20 23:57:33 -0700 (Sun, 20 Apr 2008)
Log Message:
-----------
boost-thread test
Added Paths:
-----------
sandbox/trunk/src/cc/boost_thread.cc
Added: sandbox/trunk/src/cc/boost_thread.cc
===================================================================
--- sandbox/trunk/src/cc/boost_thread.cc (rev 0)
+++ sandbox/trunk/src/cc/boost_thread.cc 2008-04-21 06:57:33 UTC (rev 670)
@@ -0,0 +1,25 @@
+// Demonstrates how to access the handle to the underlying system thread via
+// boost threads. It turns out that this wasn't available in 1.34;
+// native_handle() was added in 1.35.
+
+#include <boost/bind.hpp>
+#include <boost/thread.hpp>
+#include <iostream>
+
+using namespace boost;
+using namespace std;
+
+void
+f()
+{
+ thread t;
+ cout << "hello from " << t.native_handle() << endl;
+}
+
+int
+main()
+{
+ thread t(bind(f));
+ t.join();
+ return 0;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|