mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: std::condition_variable::wait_for() breakage when system_clock changes C++11 MIPS
Date: Wed, 3 Aug 2016 23:47:07 -0400	[thread overview]
Message-ID: <20160804034706.GF15995@brightrain.aerifal.cx> (raw)
In-Reply-To: <000E3F7F-D1BA-4B68-9BD2-9E69A792A080@wardco.com>

On Wed, Aug 03, 2016 at 10:29:45AM -0700, Ward Willats wrote:
> 
> > On Aug 3, 2016, at 4:27 AM, Szabolcs Nagy <nsz@port70.net> wrote:
> > 
> > * Ward Willats <musl@wardco.com> [2016-08-02 16:33:29 -0700]:
> >> 
> >> In short, the std::condition_variable API that takes a
> >> std::chrono:duration does not work, but the one that takes a
> >> std::chrono::time_point does.
> >> 
> > 
> > this is a libstdc++ issue so the gcc version matters.
> > (i can see condvar related issues fixed in gcc bugzilla)
> > 
> > there are several issues with the c++11 condvar timeout api e.g.
> > http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#887
> > so i'd avoid using c++, it's just a broken abstraction layer
> > on top of the pthreads api with poor specification.. meanwhile
> > pthreads works fine and is portable.
> > 
> 
> Thanks. Don't need the portability, but <thread> is arguably MORE
> portable -- depending on the platforms of interest. Anyway the
> pthread_t is available if we want to get down and dirty -- and we do
> sometimes (e.g. thread cancelling, naming). The link just
> demonstrates that poor-old pthreads can't model the rich abstraction
> of C++ without work arounds! :)

pthread cond variables can wait on CLOCK_REALTIME or CLOCK_MONOTONIC,
addressing this issue, always with "until" instead of "for" semantics
(but for monotonic, "for" and "until" are functionally equivalent).
However musl may not correctly handle the case where the realtime
clock changes during the wait. I'll look into this.

Rich


      reply	other threads:[~2016-08-04  3:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-02 23:33 Ward Willats
2016-08-02 23:40 ` Patrick Oppenlander
2016-08-03 11:27 ` Szabolcs Nagy
2016-08-03 17:29   ` Ward Willats
2016-08-04  3:47     ` Rich Felker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160804034706.GF15995@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).