mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 20:20:14 +01:00
extmod/modbluetooth: Don't hold atomic section during mp_sched_schedule.
Because, for example, on unix the atomic section isn't re-entrant, and mp_sched_schedule() will try to re-acquire the atomic section.
This commit is contained in:
committed by
Damien George
parent
0da47ecc93
commit
8119ec0765
@@ -613,17 +613,16 @@ int mp_bluetooth_gatts_set_buffer(uint16_t value_handle, size_t len, bool append
|
||||
#if MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE
|
||||
|
||||
STATIC void gattc_on_data_available(uint16_t event, uint16_t conn_handle, uint16_t value_handle, const struct os_mbuf *om) {
|
||||
MICROPY_PY_BLUETOOTH_ENTER
|
||||
size_t len = OS_MBUF_PKTLEN(om);
|
||||
len = mp_bluetooth_gattc_on_data_available_start(event, conn_handle, value_handle, len);
|
||||
mp_uint_t atomic_state;
|
||||
len = mp_bluetooth_gattc_on_data_available_start(event, conn_handle, value_handle, len, &atomic_state);
|
||||
while (len > 0 && om != NULL) {
|
||||
size_t n = MIN(om->om_len, len);
|
||||
mp_bluetooth_gattc_on_data_available_chunk(OS_MBUF_DATA(om, const uint8_t *), n);
|
||||
len -= n;
|
||||
om = SLIST_NEXT(om, om_next);
|
||||
}
|
||||
mp_bluetooth_gattc_on_data_available_end();
|
||||
MICROPY_PY_BLUETOOTH_EXIT
|
||||
mp_bluetooth_gattc_on_data_available_end(atomic_state);
|
||||
}
|
||||
|
||||
STATIC int gap_scan_cb(struct ble_gap_event *event, void *arg) {
|
||||
|
||||
Reference in New Issue
Block a user