Skip to content

Commit

Permalink
Added ChibiOS specific patches.
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmartins authored and Renato Campos committed Jan 24, 2024
1 parent 0a0452b commit f9a360d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/api/sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -2668,10 +2668,15 @@ static void select_check_waiters(int s, int has_recvevent, int has_sendevent, in
#endif /* LWIP_SOCKET_SELECT */
if (do_signal) {
scb->sem_signalled = 1;
/* For !LWIP_TCPIP_CORE_LOCKING, we don't call SYS_ARCH_UNPROTECT() before signaling
the semaphore, as this might lead to the select thread taking itself off the list,
invalidating the semaphore. */
sys_sem_signal(SELECT_SEM_PTR(scb->sem));
/* Don't call SYS_ARCH_UNPROTECT() before signaling the semaphore, as this might
lead to the select thread taking itself off the list, invalidating the semaphore. */
/* CHIBIOS FIX: specific variant of this call to be called from within
a lock.*/
#if !SYS_LIGHTWEIGHT_PROT
sys_sem_signal(&scb->sem);
#else
sys_sem_signal_S(&scb->sem);
#endif
}
}
#if LWIP_TCPIP_CORE_LOCKING
Expand Down
4 changes: 4 additions & 0 deletions src/include/lwip/sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ err_t sys_sem_new(sys_sem_t *sem, u8_t count);
* @param sem the semaphore to signal
*/
void sys_sem_signal(sys_sem_t *sem);

/* CHIBIOS FIX: specific variant of this call to be called from within a lock.*/
void sys_sem_signal_S(sys_sem_t *sem);

/**
* @ingroup sys_sem
* Blocks the thread while waiting for the semaphore to be signaled. If the
Expand Down

0 comments on commit f9a360d

Please sign in to comment.