InternetSocket: better protect _callback

sigio callbacks can be triggered from interrupt, so changing _callback
needs critical section protection, not just a mutex.
pull/9248/head
Kevin Bracey 2019-01-03 17:57:04 +02:00
parent 0f6a4cd0bd
commit ab037c6f69
3 changed files with 4 additions and 2 deletions

View File

@ -22,6 +22,7 @@ set(unittest-test-sources
features/netsocket/DTLSSocket/test_DTLSSocket.cpp
stubs/Mutex_stub.cpp
stubs/mbed_assert_stub.c
stubs/mbed_critical_stub.c
stubs/equeue_stub.c
../features/nanostack/coap-service/test/coap-service/unittest/stub/mbedtls_stub.c
stubs/EventQueue_stub.cpp

View File

@ -21,6 +21,7 @@ set(unittest-test-sources
features/netsocket/TLSSocket/test_TLSSocket.cpp
stubs/Mutex_stub.cpp
stubs/mbed_assert_stub.c
stubs/mbed_critical_stub.c
stubs/equeue_stub.c
../features/nanostack/coap-service/test/coap-service/unittest/stub/mbedtls_stub.c
stubs/EventQueue_stub.cpp

View File

@ -207,9 +207,9 @@ void InternetSocket::event()
void InternetSocket::sigio(Callback<void()> callback)
{
_lock.lock();
core_util_critical_section_enter();
_callback = callback;
_lock.unlock();
core_util_critical_section_exit();
}
void InternetSocket::attach(Callback<void()> callback)