blocking on socket I/O and classic API

Chris Johns chrisj at rtems.org
Wed Apr 13 01:58:08 UTC 2016


On 13/04/2016 04:58, Adit Sahasrabudhe wrote:
>
> This is really a general question about mixing POSIX API calls and
> Classic API ones. We are using networking in our system (ARM Cortex-A9
> based), so we have a task that is blocking on a socket file descriptor,
> just using a select() call. We are using RTEMS classic API for tasks and
> semaphores. We want to add a message queue to this task, and would like
> to have it be asynchronous, so that we can have a single blocking call
> that waits for either the socket FD or a message queue.
>
> Is there a way to mix the classic message queue API with a socket FD for
> blocking?

No they are separate resources.

> What are the ways in which people do this?

Threads in RTEMS are low cost and fast so why not have a thread block on 
each resource and synchronise the common path with a mutex? It achieves 
the same thing.

Threading, which RTEMS is good at, means you do not need to use select, 
poll or other process level mechanisms. It does mean you need to 
decompose your application design around these blocking calls on 
important resources to threads.

We provide select to improve portability of existing software.

Chris



More information about the users mailing list