From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1237 invoked by alias); 6 Aug 2002 22:13:59 -0000 Mailing-List: contact ecos-maintainers-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: ecos-maintainers-owner@sources.redhat.com Received: (qmail 1223 invoked from network); 6 Aug 2002 22:13:58 -0000 Message-ID: <00ec01c23d96$87caf890$4e0910ac@engineering.intertel.com> From: "Wade Jensen" To: , Subject: timed condition variable patch Date: Tue, 06 Aug 2002 15:13:00 -0000 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_00E9_01C23D5B.DB5B7EC0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 X-SW-Source: 2002-08/txt/msg00010.txt.bz2 This is a multi-part message in MIME format. ------=_NextPart_000_00E9_01C23D5B.DB5B7EC0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-length: 284 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 ------=_NextPart_000_00E9_01C23D5B.DB5B7EC0 Content-Type: application/octet-stream; name="patch.unlock_inner_assertion" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="patch.unlock_inner_assertion" Content-length: 1385 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=0A= --- ecos-v2-alpha-snap-orig/packages/kernel/current/src/sync/mutex.cxx Tue = Aug 6 14:57:53 2002=0A= +++ ecos-v2-alpha-snap/packages/kernel/current/src/sync/mutex.cxx Tue Aug = 6 14:57:53 2002=0A= @@ -807,12 +807,24 @@ Cyg_Condition_Variable::wait_inner( Cyg_=0A= queue.enqueue( self );=0A= =20=0A= // Avoid calling ASRs during the following unlock.=0A= self->set_asr_inhibit();=0A= =20=0A= - // Unlock the scheduler and switch threads=0A= - Cyg_Scheduler::unlock_reschedule();=0A= + // The set_timer routine could have waken the thread up again. Do n= ot=0A= + // call unlock_reschedule if this thread is still in the running state= .=0A= + // This seems to happen a lot if this routine was called from select()= .=0A= +=0A= + if (self->get_state() =3D=3D Cyg_Thread::RUNNING)=0A= + {=0A= + // Just unlock the scheduler. Do not force a reschedule.=0A= + Cyg_Scheduler::unlock();=0A= + }=0A= + else=0A= + {=0A= + // Unlock the scheduler and switch threads=0A= + Cyg_Scheduler::unlock_reschedule();=0A= + }=0A= =20=0A= // Allow ASRs again=0A= self->clear_asr_inhibit();=0A= =20=0A= CYG_ASSERTCLASS( this, "Bad this pointer");=0A= ------=_NextPart_000_00E9_01C23D5B.DB5B7EC0--