Skip to content

Commit 327445a

Browse files
Norbert Hessenor-bot
Norbert Hesse
authored andcommitted
release _semaphore only once
see issues #12325
1 parent bb48fa4 commit 327445a

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

features/cellular/framework/AT/AT_CellularContext.cpp

+2-6
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)