Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes: ``` lib/acl_threadsupport/test/acl_threadsupport_test.cpp:111:5: Type: Check of thread-shared field evades lock acquisition (LOCK_EVASION) lib/acl_threadsupport/test/acl_threadsupport_test.cpp:106:9: 1. thread1_checks_field: Thread1 uses the value read from static field "threadtest_state" in the condition "threadtest_state == 2". It sees that the condition is false. Control is switched to Thread2. lib/acl_threadsupport/test/acl_threadsupport_test.cpp:106:9: 2. thread2_checks_field: Thread2 uses the value read from static field "threadtest_state" in the condition "threadtest_state == 2". It sees that the condition is false. lib/acl_threadsupport/test/acl_threadsupport_test.cpp:110:5: 3. thread2_acquires_lock: Thread2 acquires lock "mymutex". lib/acl_threadsupport/src/acl_threadsupport.c:100:42: 3.1. lock: "pthread_mutex_lock" locks "mutex". lib/acl_threadsupport/test/acl_threadsupport_test.cpp:111:5: 4. thread2_modifies_field: Thread2 sets "threadtest_state" to a new value. Note that this write can be reordered at runtime to occur before instructions that do not access this field within this locked region. After Thread2 leaves the critical section, control is switched back to Thread1. lib/acl_threadsupport/test/acl_threadsupport_test.cpp:110:5: 5. thread1_acquires_lock: Thread1 acquires lock "mymutex". lib/acl_threadsupport/src/acl_threadsupport.c:100:42: 5.1. lock: "pthread_mutex_lock" locks "mutex". lib/acl_threadsupport/test/acl_threadsupport_test.cpp:111:5: 6. thread1_overwrites_value_in_field: Thread1 sets "threadtest_state" to a new value. Now the two threads have an inconsistent view of "threadtest_state" and updates to fields correlated with "threadtest_state" may be lost. lib/acl_threadsupport/test/acl_threadsupport_test.cpp:106:9: 7. use_same_locks_for_read_and_modify: Guard the modification of "threadtest_state" and the read used to decide whether to modify "threadtest_state" with the same set of locks. ```
- Loading branch information