fixed bugs #41495 Possible threading issue in select() and #43278

event_callback() handle context switch when calling sys_sem_signal()
This commit is contained in:
sg 2014-10-28 22:28:50 +01:00
parent b89e10c3e6
commit d6fbe2a5ad
2 changed files with 6 additions and 1 deletions

View File

@ -127,6 +127,10 @@ HISTORY
++ Bugfixes:
2014-10-21: Simon Goldschmidt (patch by Joel Cunningham and Albert Huitsing)
* sockts.c: fixed bugs #41495 Possible threading issue in select() and #43278
event_callback() handle context switch when calling sys_sem_signal()
2014-10-21: Simon Goldschmidt
* api_msg.c: fixed bug #38219 Assert on TCP netconn_write with sndtimeout set

View File

@ -1387,6 +1387,8 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
/* At this point, SYS_ARCH is still protected! */
again:
for (scb = select_cb_list; scb != NULL; scb = scb->next) {
/* remember the state of select_cb_list to detect changes */
last_select_cb_ctr = select_cb_ctr;
if (scb->sem_signalled == 0) {
/* semaphore not signalled yet */
int do_signal = 0;
@ -1414,7 +1416,6 @@ again:
}
}
/* unlock interrupts with each step */
last_select_cb_ctr = select_cb_ctr;
SYS_ARCH_UNPROTECT(lev);
/* this makes sure interrupt protection time is short */
SYS_ARCH_PROTECT(lev);