www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2001/09/12/18:43:35

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-developers-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com
Subject: Re: Quick testfeedback...
From: Robert Collins <robert DOT collins AT itdomain DOT com DOT au>
To: cygwin-developers AT cygwin DOT com
In-Reply-To: <20010912125641.A18358@redhat.com>
References: <1000209619 DOT 7293 DOT 196 DOT camel AT lifelesswks>
<20010912184031 DOT X1285 AT cygbert DOT vinschen DOT de>
<20010912184812 DOT Z1285 AT cygbert DOT vinschen DOT de>
<20010912125641 DOT A18358 AT redhat DOT com>
X-Mailer: Evolution/0.13 (Preview Release)
Date: 13 Sep 2001 08:44:07 +1000
Message-Id: <1000334648.31768.33.camel@lifelesswks>
Mime-Version: 1.0
X-OriginalArrivalTime: 12 Sep 2001 22:30:58.0150 (UTC) FILETIME=[97F66060:01C13BDA]

On Thu, 2001-09-13 at 02:56, Christopher Faylor wrote:
> On Wed, Sep 12, 2001 at 06:48:12PM +0200, Corinna Vinschen wrote:
> >On Wed, Sep 12, 2001 at 06:40:31PM +0200, Corinna Vinschen wrote:
> >> On Tue, Sep 11, 2001 at 10:00:11PM +1000, Robert Collins wrote:
> >> > +  if (iswinnt)
> >> > +    InitializeCriticalSection (&criticalsection);
> >> > +  else
> >> > +    {
> >> > +      this->win32_obj_id =::CreateMutex (&sec_none_nih, false, NULL);
> >> > +      if (!win32_obj_id)
> >> > +        magic = 0;
> >> > +    }
> >> 
> >> Could somebody give me a short hint why we're using critical
> >> sections on NT only?  I need some three word only description...
> >> something memorable...
> >
> >Whoops, is the fact that TryEnterCriticalSection() is only
> >available since NT4 the reason, perhaps???
> 
> Apparently.
> 
> Cygwin's muto class actually does a sort of critical section and has
> TryEnterCriticalSection capabilities.
> 
> I don't think that mutos are necessarily general purpose enough for
> this but maybe we could do something similar.  Or we could probably
> roll our own version of TryEnterCriticalSection.

There's little point unless we can allso roll our own
SignalObjectAndWait. Win95 is lacking syncronisation capabilities left
right and cetnre...

Looking at the mutos class it uses Event objects... Event objects are
cross process, and therefore subject to the same issues that force
mutex's to be slow. If your perf tests show mutos' to be faster than
mutexs I'll happily eat my words :].

Also the code there is a little arcane.

for example, the while loop on line 85 looks like it can only ever
execute once - either it jumps to gotoit, or returns 0. So why a loop
construct?

I'll look into mutos and see if I can see any unfairness or races in it.
The point being that we are currently wrapping "fair" objects, if we
roll-our-own, we run the risk of unfair scheduling being introduced over
the base fair win32 objects.

However, if someone happens across a disassembly of TryEnterCritical
section and it can be implemented in user space on win9x :]

Rob

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019