Skip to content

Commit 2234dac

Browse files
author
Cruz Monrreal
authored
Merge pull request #9751 from AriParkkila/athandler-set_at_timeout
Cellular: Fix ATHandler set/restore_at_timeout with mutex lock
2 parents e3bc37b + d48adcc commit 2234dac

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
@@ -273,20 +273,24 @@ nsapi_error_t ATHandler::unlock_return_error()
273273

274274
void ATHandler::set_at_timeout(uint32_t timeout_milliseconds, bool default_timeout)
275275
{
276+
lock();
276277
if (default_timeout) {
277278
_previous_at_timeout = timeout_milliseconds;
278279
_at_timeout = timeout_milliseconds;
279280
} else if (timeout_milliseconds != _at_timeout) {
280281
_previous_at_timeout = _at_timeout;
281282
_at_timeout = timeout_milliseconds;
282283
}
284+
unlock();
283285
}
284286

285287
void ATHandler::restore_at_timeout()
286288
{
289+
lock();
287290
if (_previous_at_timeout != _at_timeout) {
288291
_at_timeout = _previous_at_timeout;
289292
}
293+
unlock();
290294
}
291295

292296
void ATHandler::process_oob()

0 commit comments

Comments
 (0)