Skip to content

Commit 3c23a1c

Browse files
committed
form_match_list(): Don't use _Atomic
There is no need to ensure the "id" variable is incremented in an atomic way, because we don't care if two threads will use the same value. The crash that got debugged on commit 9f73b37 was due to another reason: not using "id" variable if it is 0. This has been fixed. Removing it gets rid of some small overhead, and also allows MSVC compilation.
1 parent b4f22e4 commit 3c23a1c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

link-grammar/parse/fast-match.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -595,8 +595,8 @@ form_match_list(fast_matcher_t *ctxt, int w,
595595
}
596596

597597
#ifdef VERIFY_MATCH_LIST
598-
static _Atomic(uint16_t) id = 0;
599-
uint16_t lid = ++id; /* A local copy, for multi-threading support. */
598+
static uint16_t id = 0;
599+
uint16_t lid = ++id; /* A stable local copy, for multi-threading support. */
600600
#else
601601
const uint16_t lid = 0;
602602
#endif

0 commit comments

Comments
 (0)