On 2014-08-13, Alec Ten Harmsel <a...@alectenharmsel.com> wrote:

>> I may have to stick with sockets when I want to block until some event
>> happens.
>
> To be clear, do you want to block or sleep/yield until an event
> happens?

I don't see the difference -- isn't that what a blocking call does:
sleep/yield until some event happens?

> I'm sorry for not being too helpful. Just one last question: Can you 
> describe what exactly your code is supposed to do, or is it something
> that you can't talk about because it's a work thing? I don't care 
> either way, but I'm just curious because it seems you need to
> optimize quite a bit.

One process implements a communications protocol that is maintaining
communications links with a handful of slave devices connected to
serial ports running at baud rates up to 230400 baud (38400 is the
most common).  There are typically one (or maybe two) hundred messages
per second being exchanged with each slave device.  I'll call that
process the server.

There are other client processes that want to access the slaves and
the inforamation being received from them. Some of the clients just
want to do low-frequency transactions for configuration/diagnostic
purposes, and Unix domain sockets work fine for that.

Other clients may want to wake up every time a certain high frequency
event happens.  That's where I'm trying to use condition variables.

Other clients will periodically (typically once every 5-50 ms) want to
see the most recent copy of a particular received message.  I'm
thinking about using shared memory and rwlocks for that, but I haven't
figured out how to deal with the case where a process aborts while
holding a lock.

-- 
Grant Edwards               grant.b.edwards        Yow! Kids, don't gross me
                                  at               off ... "Adventures with
                              gmail.com            MENTAL HYGIENE" can be
                                                   carried too FAR!


Reply via email to