Gentoo Archives: gentoo-user

From: Grant Edwards <grant.b.edwards@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: OT: pthreads condition variable/mutex question
Date: Wed, 13 Aug 2014 20:19:48
Message-Id: lsgh86$4m0$1@ger.gmane.org
In Reply to: Re: [gentoo-user] Re: OT: pthreads condition variable/mutex question by Alec Ten Harmsel
1 On 2014-08-13, Alec Ten Harmsel <alec@××××××××××××××.com> wrote:
2
3 >> I may have to stick with sockets when I want to block until some event
4 >> happens.
5 >
6 > To be clear, do you want to block or sleep/yield until an event
7 > happens?
8
9 I don't see the difference -- isn't that what a blocking call does:
10 sleep/yield until some event happens?
11
12 > I'm sorry for not being too helpful. Just one last question: Can you
13 > describe what exactly your code is supposed to do, or is it something
14 > that you can't talk about because it's a work thing? I don't care
15 > either way, but I'm just curious because it seems you need to
16 > optimize quite a bit.
17
18 One process implements a communications protocol that is maintaining
19 communications links with a handful of slave devices connected to
20 serial ports running at baud rates up to 230400 baud (38400 is the
21 most common). There are typically one (or maybe two) hundred messages
22 per second being exchanged with each slave device. I'll call that
23 process the server.
24
25 There are other client processes that want to access the slaves and
26 the inforamation being received from them. Some of the clients just
27 want to do low-frequency transactions for configuration/diagnostic
28 purposes, and Unix domain sockets work fine for that.
29
30 Other clients may want to wake up every time a certain high frequency
31 event happens. That's where I'm trying to use condition variables.
32
33 Other clients will periodically (typically once every 5-50 ms) want to
34 see the most recent copy of a particular received message. I'm
35 thinking about using shared memory and rwlocks for that, but I haven't
36 figured out how to deal with the case where a process aborts while
37 holding a lock.
38
39 --
40 Grant Edwards grant.b.edwards Yow! Kids, don't gross me
41 at off ... "Adventures with
42 gmail.com MENTAL HYGIENE" can be
43 carried too FAR!

Replies

Subject Author
Re: [gentoo-user] Re: OT: pthreads condition variable/mutex question Alec Ten Harmsel <alec@××××××××××××××.com>
Re: [gentoo-user] Re: OT: pthreads condition variable/mutex question "J. Roeleveld" <joost@××××××××.org>