Skip to content

Commit c17f32f

Browse files
authored
Merge pull request #12507 from variablo87/cellular-context-semaphore-release
Cellular: release _semaphore only once
2 parents 1f2e66d + 327445a commit c17f32f

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

features/cellular/framework/AT/AT_CellularContext.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -886,11 +886,7 @@ void AT_CellularContext::cellular_callback(nsapi_event_t ev, intptr_t ptr)
886886
cellular_connection_status_t st = (cellular_connection_status_t)ev;
887887
_cb_data.error = data->error;
888888
_cb_data.final_try = data->final_try;
889-
if (data->final_try) {
890-
if (_current_op != OP_INVALID) {
891-
_semaphore.release();
892-
}
893-
}
889+
894890
#if MBED_CONF_CELLULAR_USE_APN_LOOKUP
895891
if (st == CellularSIMStatusChanged && data->status_data == CellularDevice::SimStateReady &&
896892
_cb_data.error == NSAPI_ERROR_OK) {
@@ -937,7 +933,7 @@ void AT_CellularContext::cellular_callback(nsapi_event_t ev, intptr_t ptr)
937933
#endif
938934

939935
if (_is_blocking) {
940-
if (_cb_data.error != NSAPI_ERROR_OK) {
936+
if ((data->final_try) || (_cb_data.error != NSAPI_ERROR_OK)) {
941937
// operation failed, release semaphore
942938
if (_current_op != OP_INVALID) {
943939
_current_op = OP_INVALID;

0 commit comments

Comments
 (0)