Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use atomic operations for some index variables #715

Merged
merged 1 commit into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading