CHERIoT-Platform / network-stack

5 stars 5 forks source link

Make the network stack API multiwaiter-compatible #44

Open hlef opened 1 month ago

hlef commented 1 month ago

The multiwait API allows a waiter to wait on multiple events.

It would be very useful if we could make the network API compatible with this API so that a thread can wait on several socket receives, accepts, etc. Callers currently need to create multiple threads to do this. This would be the equivalent of poll or select.

To make the network stack API multiwaiter-compatible, we need to expose a futex.

A few locations where adding this futex would make sense (to be edited when new ideas come):

hlef commented 1 month ago

Note on how to implement this for the network_socket_accept_tcp case: we likely want to keep a futex that counts how many connections are ready to be accepted. We can maintain that through the on_tcp_connect callback (linked into FreeRTOS+TCP through FREERTOS_SO_TCP_CONN_HANDLER).