507765d95ca429a6772a78469fe331713eacde5d
2 #include <boost/thread.hpp>
9 using boost::chrono::milliseconds
;
10 using boost::this_thread::sleep_for
;
12 /*----------------------------------------------------------------------*\
14 \*---------------------------------------------------------------------*/
16 /*--------------------------------------*\
18 \*-------------------------------------*/
20 /*--------------------------------------*\
22 \*-------------------------------------*/
24 void helloThread_ProcedureArgs(void);
26 /*--------------------------------------*\
28 \*-------------------------------------*/
30 static void runnable(float x
);
32 /*----------------------------------------------------------------------*\
34 \*---------------------------------------------------------------------*/
36 /*--------------------------------------*\
38 \*-------------------------------------*/
40 void helloThread_ProcedureArgs(void)
42 cout
<< "\nthread : procedure args : start" << endl
;
45 thread
threadRunnable(runnable
, x
); // x sera passer à runnable
47 cout
<< "Waiting for thread ..." << endl
;
49 threadRunnable
.join();
51 cout
<< "thread : procedure args : end" << endl
;
54 /*--------------------------------------*\
56 \*-------------------------------------*/
58 void runnable(float x
)
60 cout
<< "runnable : start" << endl
;
61 cout
<< "x = " << x
<< endl
;
63 // Pretend to do something useful...
65 sleep_for(milliseconds(2000)); // from version 1.53 only
68 cout
<< "runnable: end" << endl
;
71 /*----------------------------------------------------------------------*\
73 \*---------------------------------------------------------------------*/