Skip to content

Commit

Permalink
env: posix: Make env_bit_test() atomic
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
Signed-off-by: Shai Fultheim <shai.fultheim@huawei.com>
  • Loading branch information
robertbaldyga committed Sep 20, 2023
1 parent 37bae0e commit 5522d19
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions env/posix/ocf_env.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright(c) 2019-2022 Intel Corporation
* Copyright(c) 2023 Huawei Technologies
* SPDX-License-Identifier: BSD-3-Clause
*/

Expand Down Expand Up @@ -586,6 +587,7 @@ static inline bool env_bit_test(int nr, const volatile unsigned long *addr)
const char *byte = (char *)addr + (nr >> 3);
char mask = 1 << (nr & 7);

__sync_synchronize();
return !!(*byte & mask);
}

Expand Down

0 comments on commit 5522d19

Please sign in to comment.