Ajout de l'ensemble du workspace.
[GPU.git] / WCudaMSE / Tuto_Boost / src / cpp / core / thread / 02_thread_procedure_args.cpp
diff --git a/WCudaMSE/Tuto_Boost/src/cpp/core/thread/02_thread_procedure_args.cpp b/WCudaMSE/Tuto_Boost/src/cpp/core/thread/02_thread_procedure_args.cpp
new file mode 100755 (executable)
index 0000000..507765d
--- /dev/null
@@ -0,0 +1,74 @@
+#include <iostream>\r
+#include <boost/thread.hpp>\r
+\r
+\r
+using std::cout;\r
+using std::endl;\r
+\r
+using boost::thread;\r
+using boost::chrono::milliseconds;\r
+using boost::this_thread::sleep_for;\r
+\r
+/*----------------------------------------------------------------------*\\r
+ |*                    Declaration                                     *|\r
+ \*---------------------------------------------------------------------*/\r
+\r
+/*--------------------------------------*\\r
+ |*            Imported                *|\r
+ \*-------------------------------------*/\r
+\r
+/*--------------------------------------*\\r
+ |*            Public                  *|\r
+ \*-------------------------------------*/\r
+\r
+void helloThread_ProcedureArgs(void);\r
+\r
+/*--------------------------------------*\\r
+ |*            Private                 *|\r
+ \*-------------------------------------*/\r
+\r
+static void runnable(float x);\r
+\r
+/*----------------------------------------------------------------------*\\r
+ |*                    Implementation                                  *|\r
+ \*---------------------------------------------------------------------*/\r
+\r
+/*--------------------------------------*\\r
+ |*            Public                  *|\r
+ \*-------------------------------------*/\r
+\r
+void helloThread_ProcedureArgs(void)\r
+    {\r
+    cout << "\nthread : procedure args : start" << endl;\r
+\r
+    float x = 3.14;\r
+   thread threadRunnable(runnable, x); // x sera passer à runnable\r
+\r
+    cout << "Waiting for thread ..." << endl;\r
+\r
+    threadRunnable.join();\r
+\r
+    cout << "thread : procedure args : end" << endl;\r
+    }\r
+\r
+/*--------------------------------------*\\r
+ |*            Private                 *|\r
+ \*-------------------------------------*/\r
+\r
+void runnable(float x)\r
+    {\r
+    cout << "runnable : start" << endl;\r
+    cout << "x = " << x << endl;\r
+\r
+    // Pretend to do something useful...\r
+       {\r
+       sleep_for(milliseconds(2000)); // from version 1.53 only\r
+       }\r
+\r
+    cout << "runnable: end" << endl;\r
+    }\r
+\r
+/*----------------------------------------------------------------------*\\r
+ |*                    End                                             *|\r
+ \*---------------------------------------------------------------------*/\r
+\r