From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,371144ace2969d7e X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: "Alex R. Mosteo" Newsgroups: comp.lang.ada Subject: Re: C++ primer on multithreading Followup-To: comp.lang.ada Date: Wed, 20 Apr 2011 15:04:06 +0200 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit Injection-Date: Wed, 20 Apr 2011 13:04:07 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="GTXwwBF3FOlS510nQf8qvQ"; logging-data="18002"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/8eEabU/NgUVNOIBOMcTB7" User-Agent: KNode/4.4.9 Cancel-Lock: sha1:Ot1RzlT1jvCvu99+TA64zLS5NUw= Xref: g2news1.google.com comp.lang.ada:18921 Date: 2011-04-20T15:04:06+02:00 List-Id: Maciej Sobczak wrote: > On Apr 20, 12:45 pm, "Alex R. Mosteo" > wrote: > >> I need to do some multi-threading stuff, in the sense that I will need >> the equivalent of a protected object with some conditional blocking >> entries. > > This is not enough. What are you going to do with these entries? How > many threads will use the same entry? How many entries will be used at > a time by a single thread? Not many threads involved, and I have been really not very explicit. Basically I need a protected queue with blocking semantics; several writters, one consumer. Also more generally, I wondered too if there's some ready-to-use protected stuff in C++ that spares me dealing with mutexes to emulate a synchronized interface. > If you don't try to reimplement the Ada semantics in full (select > statement, requeue, anyone? :-) ), then conditional variables are > sufficient to implement typical multithreading patterns - this can be > nicely encapsulated by the "protected object" interface. No, I don't want the full boat :) Also I wouldn't want to fall in the inverse trap of what's so frequently touted here of writing C in Ada. So any pointers on what are considered best practices nowadays in C++ for multithreading are welcome too. > Boost is a good quality wrapper for system services and therefore > useful for portability, but brings a whole lot of dependencies with it > - it might or might not be of concern. That's no problem. I will be using stock debian systems, so as long as it's there... Alex. > > -- > Maciej Sobczak * http://www.msobczak.com * http://www.inspirel.com