VFS: Allocate socket select semaphore outside ISR

This commit is contained in:
Roland Dobai
2019-04-01 12:50:54 +02:00
parent cc8652d8d2
commit 5988e77a3a
3 changed files with 21 additions and 0 deletions

View File

@@ -40,6 +40,14 @@ static void lwip_stop_socket_select_isr(BaseType_t *woken)
}
}
static void *lwip_get_socket_select_semaphore()
{
/* Calling this from the same process as select() will ensure that the semaphore won't be allocated from
* ISR (lwip_stop_socket_select_isr).
*/
return (void *) sys_thread_sem_get();
}
static int lwip_fcntl_r_wrapper(int fd, int cmd, va_list args)
{
return lwip_fcntl_r(fd, cmd, va_arg(args, int));
@@ -61,6 +69,7 @@ void esp_vfs_lwip_sockets_register()
.read = &lwip_read_r,
.fcntl = &lwip_fcntl_r_wrapper,
.ioctl = &lwip_ioctl_r_wrapper,
.get_socket_select_semaphore = &lwip_get_socket_select_semaphore,
.socket_select = &lwip_select,
.stop_socket_select = &lwip_stop_socket_select,
.stop_socket_select_isr = &lwip_stop_socket_select_isr,