Skip to content

Commit d48adcc

Browse files
author
Ari Parkkila
committed
Cellular: Fix ATHandler set/restore_at_timeout with mutex lock
1 parent 31da50e commit d48adcc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

features/cellular/framework/AT/ATHandler.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,20 +272,24 @@ nsapi_error_t ATHandler::unlock_return_error()
272272

273273
void ATHandler::set_at_timeout(uint32_t timeout_milliseconds, bool default_timeout)
274274
{
275+
lock();
275276
if (default_timeout) {
276277
_previous_at_timeout = timeout_milliseconds;
277278
_at_timeout = timeout_milliseconds;
278279
} else if (timeout_milliseconds != _at_timeout) {
279280
_previous_at_timeout = _at_timeout;
280281
_at_timeout = timeout_milliseconds;
281282
}
283+
unlock();
282284
}
283285

284286
void ATHandler::restore_at_timeout()
285287
{
288+
lock();
286289
if (_previous_at_timeout != _at_timeout) {
287290
_at_timeout = _previous_at_timeout;
288291
}
292+
unlock();
289293
}
290294

291295
void ATHandler::process_oob()

0 commit comments

Comments
 (0)