X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9c0ae9ef71784f2d41e8ffe8a4400177227b85fb..7fdd9d11419684606beb08a8a7bc673955eb08af:/doc/gtut-tour-5-globals.doc diff --git a/doc/gtut-tour-5-globals.doc b/doc/gtut-tour-5-globals.doc index f08d0e0898..b14acd8c5d 100644 --- a/doc/gtut-tour-5-globals.doc +++ b/doc/gtut-tour-5-globals.doc @@ -1,6 +1,16 @@ /** @page GRAS_tut_tour_globals Lesson 5: Using globals in processes +\section GRAS_tut_tour_globals_toc Table of Contents + - \ref GRAS_tut_tour_globals_intro + - \ref GRAS_tut_tour_globals_use + - \ref GRAS_tut_tour_callback_pitfall + - \ref GRAS_tut_tour_callback_recap + +
+ +\section GRAS_tut_tour_globals_intro Introduction + Callbacks are great to express your processes as state machines, but they pose another problem: callbacks don't have acces to the variable declared within the scope of the process' main function (of course). You should @@ -13,6 +23,8 @@ the several instances of your process, leading to bad problems. Instead, you you have to put all globals in a structure, and let GRAS handle it with the gras_userdata_* functions (there is only 3 of them ;). +\section GRAS_tut_tour_globals_use Putting globals into action + We will now modify the example to add a "kill" message, and let the server loop on incoming messages until it gets such a message. We only need a boolean, so the structure is quite simple: @@ -77,6 +89,6 @@ That's it, we're done. We have a server able to handle any number of messages, which the client can stop remotely properly. That's already something, hu? -\ref GRAS_tut_tour_logs +Go to \ref GRAS_tut_tour_logs */