public inbox for ecos-devel@sourceware.org
 help / color / mirror / Atom feed
From: jamescmaki <jamescmaki@gmail.com>
To: ecos-devel@ecos.sourceware.org
Subject: Re: Cyg_Mutex::check_this() fails
Date: Fri, 15 Mar 2013 17:56:00 -0000	[thread overview]
Message-ID: <1363370179179-225589.post@n7.nabble.com> (raw)
In-Reply-To: <000901ce09de$3d3dc0d0$b7b94270$@cc>

Hi Rene,

At this point in the code the scheduler is not locked and the mutex is not
owned. This means that it is a bad idea to be looking at the internal state
of the mutex, i.e., calling CYG_ASSERTCLASS( mx, "Corrupt mutex").

I can reproduce this issue consistently now and I am testing a fix that
changes CYG_ASSERTCLASS to CYG_ASSERT. I am hoping that this will resolve
the problem instead of just moving the failed assert into Cyg_Mutex::lock().

However even if this does fix the problem, I am still wary. From what I can
see, locked and owner are never modified without locking the scheduler. This
means that they are both updated atomically. Because of this, when the
thread in  wait_inner() resumes it should see both of these variables in a
consistent state regardless of whether it holds a lock or not. I am
wondering if this can be explained by reordering and by delaying the check
until the scheduler is locked again it avoids this problem.

-James





--
View this message in context: http://sourceware-org.1504.n7.nabble.com/Cyg-Mutex-check-this-fails-tp222044p225589.html
Sent from the Sourceware - ecos-devel mailing list archive at Nabble.com.

  reply	other threads:[~2013-03-15 17:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-13 11:36 René Schipp von Branitz Nielsen
2013-03-15 17:56 ` jamescmaki [this message]
2013-03-15 19:12   ` jamescmaki

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=1363370179179-225589.post@n7.nabble.com \
    --to=jamescmaki@gmail.com \
    --cc=ecos-devel@ecos.sourceware.org \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).