env: posix: Make env_bit_test() atomic
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com> Signed-off-by: Shai Fultheim <shai.fultheim@huawei.com>
This commit is contained in:
parent
37bae0ec47
commit
5522d19718
2
env/posix/ocf_env.h
vendored
2
env/posix/ocf_env.h
vendored
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright(c) 2019-2022 Intel Corporation
|
* Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
* Copyright(c) 2023 Huawei Technologies
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -586,6 +587,7 @@ static inline bool env_bit_test(int nr, const volatile unsigned long *addr)
|
|||||||
const char *byte = (char *)addr + (nr >> 3);
|
const char *byte = (char *)addr + (nr >> 3);
|
||||||
char mask = 1 << (nr & 7);
|
char mask = 1 << (nr & 7);
|
||||||
|
|
||||||
|
__sync_synchronize();
|
||||||
return !!(*byte & mask);
|
return !!(*byte & mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user