diff options
| author | cooljqln <cooljqln@noreply.codeberg.org> | 2025-08-04 03:39:45 +0200 |
|---|---|---|
| committer | cooljqln <cooljqln@noreply.codeberg.org> | 2025-08-04 03:39:45 +0200 |
| commit | fd064b996a432074b3e5c18b6a8c5439a372f281 (patch) | |
| tree | 4e3b2880e11f3169000d4273323399677af8c05f /lib/bt/esp_ble_mesh/common/atomic.c | |
| parent | df8fc4104e5ed884f3b52257558191955375d1e7 (diff) | |
| parent | f4eea3a18add40b84ea2494970ef5945c755f578 (diff) | |
| download | tangara-fw-fd064b996a432074b3e5c18b6a8c5439a372f281.tar.gz | |
Merge pull request 'Update esp-idf to the v5.5' (#418) from jqln/idfv5.5 into main
Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/418
Diffstat (limited to 'lib/bt/esp_ble_mesh/common/atomic.c')
| -rw-r--r-- | lib/bt/esp_ble_mesh/common/atomic.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/bt/esp_ble_mesh/common/atomic.c b/lib/bt/esp_ble_mesh/common/atomic.c index 723ce7e3..9c856cc3 100644 --- a/lib/bt/esp_ble_mesh/common/atomic.c +++ b/lib/bt/esp_ble_mesh/common/atomic.c @@ -13,7 +13,7 @@ /* * SPDX-FileCopyrightText: 2016 Intel Corporation * SPDX-FileCopyrightText: 2011-2014 Wind River Systems, Inc. - * SPDX-FileContributor: 2018-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileContributor: 2018-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -170,4 +170,18 @@ bt_mesh_atomic_val_t bt_mesh_atomic_inc(bt_mesh_atomic_t *target) return ret; } +bool bt_mesh_atomic_cas(bt_mesh_atomic_t *target, bt_mesh_atomic_val_t excepted, bt_mesh_atomic_val_t new_val) +{ + bt_mesh_atomic_lock(); + + if (*target == excepted) { + *target = new_val; + bt_mesh_atomic_unlock(); + return true; + } + + bt_mesh_atomic_unlock(); + return false; +} + #endif /* #ifndef CONFIG_ATOMIC_OPERATIONS_BUILTIN */ |
