Add comments for code with race condition
authorRoland Schulz <roland@utk.edu>
Wed, 14 May 2014 22:28:00 +0000 (18:28 -0400)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Wed, 9 Jul 2014 06:19:52 +0000 (08:19 +0200)
Change-Id: I89faa979ad605c463097e842e1112b2a24adee09

src/gromacs/gmxlib/nonbonded/nonbonded.c
src/gromacs/mdlib/clincs.c

index fb8f43c47bbb2769b4b845e0272d49847a0ed422..9efff8c5ed09d67780812e4b3dddb1f4bf299f43 100644 (file)
@@ -656,6 +656,8 @@ do_nonbonded_listed(int ftype, int nbonds,
 
         if (r2 >= fr->tab14.r*fr->tab14.r)
         {
+            /* This check isn't race free. But it doesn't matter because if a race occurs the only
+             * disadvantage is that the warning is printed twice */
             if (warned_rlimit == FALSE)
             {
                 nb_listed_warning_rlimit(x, ai, aj, global_atom_index, sqrt(r2), fr->tab14.r);
index 2a34e53ef8a4eb03294639f1505f567faf599a2b..cc9a9c98e0392cfc2804b1d66b0c92f9b1461c85 100644 (file)
@@ -648,6 +648,7 @@ static void do_lincs(rvec *x, rvec *xp, matrix box, t_pbc *pbc,
             dlen2 = 2*len2 - norm2(dx);
             if (dlen2 < wfac*len2 && (nlocat == NULL || nlocat[b]))
             {
+                /* not race free - see detailed comment in caller */
                 *warn = b;
             }
             if (dlen2 > 0)