public inbox for ecos-maintainers@sourceware.org
 help / color / mirror / Atom feed
From: "Wade Jensen" <waj4news@cox.net>
To: <ecos-patches@sources.redhat.com>, <ecos-maintainers@sources.redhat.com>
Subject: timed condition variable patch
Date: Tue, 06 Aug 2002 15:13:00 -0000	[thread overview]
Message-ID: <00ec01c23d96$87caf890$4e0910ac@engineering.intertel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 284 bytes --]

Hello,

There is a very rare condition in Cyg_Condition_Variable::wait_inner(
Cyg_Mutex *mx, cyg_tick_count timeout ) that causes the "Unnecessary call to
unlock_inner()" assertion to fail.

Here is a patch for this problem.  It is based off of the 2.0 snapshot
source.

Thanks,
Wade

[-- Attachment #2: patch.unlock_inner_assertion --]
[-- Type: application/octet-stream, Size: 1271 bytes --]

diff -r -u5 -N -p ecos-v2-alpha-snap-orig/packages/kernel/current/src/sync/mutex.cxx ecos-v2-alpha-snap/packages/kernel/current/src/sync/mutex.cxx
--- ecos-v2-alpha-snap-orig/packages/kernel/current/src/sync/mutex.cxx	Tue Aug  6 14:57:53 2002
+++ ecos-v2-alpha-snap/packages/kernel/current/src/sync/mutex.cxx	Tue Aug  6 14:57:53 2002
@@ -807,12 +807,24 @@ Cyg_Condition_Variable::wait_inner( Cyg_
         queue.enqueue( self );
 
     // Avoid calling ASRs during the following unlock.
     self->set_asr_inhibit();
 
-    // Unlock the scheduler and switch threads
-    Cyg_Scheduler::unlock_reschedule();
+    //   The set_timer routine could have waken the thread up again.  Do not
+    // call unlock_reschedule if this thread is still in the running state.
+    // This seems to happen a lot if this routine was called from select().
+
+    if (self->get_state() == Cyg_Thread::RUNNING)
+    {
+        //   Just unlock the scheduler.  Do not force a reschedule.
+        Cyg_Scheduler::unlock();
+    }
+    else
+    {
+        // Unlock the scheduler and switch threads
+        Cyg_Scheduler::unlock_reschedule();
+    }
 
     // Allow ASRs again
     self->clear_asr_inhibit();
 
     CYG_ASSERTCLASS( this, "Bad this pointer");

                 reply	other threads:[~2002-08-06 22:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='00ec01c23d96$87caf890$4e0910ac@engineering.intertel.com' \
    --to=waj4news@cox.net \
    --cc=ecos-maintainers@sources.redhat.com \
    --cc=ecos-patches@sources.redhat.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.
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).