Skip to content

Commit

Permalink
Merge pull request #715 from stweil/atomic
Browse files Browse the repository at this point in the history
Use atomic operations for some index variables
  • Loading branch information
DanBloomberg authored Sep 1, 2023
2 parents bd1ef2b + b00337b commit ed8f820
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/compare.c
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ pixCompareGray(PIX *pix1,
PIX **ppixdiff)
{
char buf[64];
static l_int32 index = 0;
static l_atomic index = 0;
l_int32 d1, d2, same, first, last;
GPLOT *gplot;
NUMA *na, *nac;
Expand Down Expand Up @@ -1078,7 +1078,7 @@ pixCompareRGB(PIX *pix1,
PIX **ppixdiff)
{
char buf[64];
static l_int32 index = 0;
static l_atomic index = 0;
l_int32 rsame, gsame, bsame, same, first, rlast, glast, blast, last;
l_float32 rdiff, gdiff, bdiff;
GPLOT *gplot;
Expand Down
6 changes: 3 additions & 3 deletions src/gplot.c
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ gplotSimplePix1(NUMA *na,
const char *title)
{
char buf[64];
static l_int32 index;
static l_atomic index;
GPLOT *gplot;
PIX *pix;

Expand Down Expand Up @@ -803,7 +803,7 @@ gplotSimplePix2(NUMA *na1,
const char *title)
{
char buf[64];
static l_int32 index;
static l_atomic index;
GPLOT *gplot;
PIX *pix;

Expand Down Expand Up @@ -844,7 +844,7 @@ gplotSimplePixN(NUMAA *naa,
const char *title)
{
char buf[64];
static l_int32 index;
static l_atomic index;
GPLOT *gplot;
PIX *pix;

Expand Down
2 changes: 1 addition & 1 deletion src/regutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ struct L_RegParams
char *testname; /*!< name of test, without '_reg' */
char *tempfile; /*!< name of temp file for compare mode output */
l_int32 mode; /*!< generate, compare or display */
l_int32 index; /*!< index into saved files for this test; 0-based */
l_atomic index; /*!< index into saved files for this test; 0-based */
l_int32 success; /*!< overall result of the test */
l_int32 display; /*!< 1 if in display mode; 0 otherwise */
L_TIMER tstart; /*!< marks beginning of the reg test */
Expand Down
2 changes: 1 addition & 1 deletion src/writefile.c
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ pixDisplayWithTitle(PIX *pixs,
{
char *tempname;
char buffer[Bufsize];
static l_int32 index = 0; /* caution: not .so or thread safe */
static l_atomic index = 0; /* caution: not .so safe */
l_int32 w, h, d, spp, maxheight, opaque, threeviews;
l_float32 ratw, rath, ratmin;
PIX *pix0, *pix1, *pix2;
Expand Down

0 comments on commit ed8f820

Please sign in to comment.