]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add a comment.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 12 Dec 2013 17:34:45 +0000 (17:34 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 12 Dec 2013 17:34:45 +0000 (17:34 +0000)
git-svn-id: https://svn.dealii.org/trunk@31983 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/base/work_stream.h

index 363c28bbc761ed64fc7aacbed8a9ebddb6244eea..63007aba91e1f7ee37cdab860ca830c34bc293dd 100644 (file)
@@ -348,6 +348,15 @@ namespace WorkStream
           // and have set the ring buffer to have exactly this size. so
           // if this function is called, we know that less than the
           // maximal number of items in currently in flight
+         //
+         // note that we need not lock access to this array since
+         // the current stage is run sequentially and we can therefore
+         // enter the following block only once at any given time.
+         // thus, there can be no race condition between checking that
+         // a flag is false and setting it to true. (there may be
+         // another thread where we release items and set 'false'
+         // flags to 'true', but that too does not produce any
+         // problems)
           ItemType *current_item = 0;
           for (unsigned int i=0; i<item_buffer.size(); ++i)
             if (item_buffer[i].currently_in_use == false)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.