public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Dan Vasaru" <dvasaru@broadpark.no>
To: <cygwin@cygwin.com>
Subject: RE: A Simple Real World Benchmark for cygwin
Date: Tue, 03 Sep 2002 09:05:00 -0000	[thread overview]
Message-ID: <CHEDKHJJDLOCCOFLMGEAOEIECLAA.dvasaru@broadpark.no> (raw)
In-Reply-To: <20020903144217.C12899@cygbert.vinschen.de>

Corrina,

Here's an idea that may work:

I run another quick benchmark that shows CoInit/CoUninit are "free" if
another CoInit is in effect. So we could make sure that the first CoInit is
not matched, whereas the rest are:

check_shortcut()
{
  CoInit(..);
  ...
  if (per_thread_coinit_count != 0) CoUnit(...); // always call except first
time
  per_thread_coinit_count++;
}

Now, the per_thread_coinit_count variable needs to be checked somewhere to
call CoUnit once more during thread/mainthread termination.

Note that if wellbehaved application calls CoUninit, it must have called
CoInit, so the COM use count never falls to zero.

Dan.

-----Original Message-----
From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com]On Behalf
Of Corinna Vinschen
Sent: Tuesday, September 03, 2002 2:42 PM
To: cygwin@cygwin.com
Subject: Re: A Simple Real World Benchmark for cygwin


On Tue, Sep 03, 2002 at 09:59:57PM +1000, Robert Collins wrote:
> On Tue, 2002-09-03 at 21:51, Corinna Vinschen wrote:
>
> > Yep, that's the problem.  And the reasoning for calling CoInit/CoUnint
> > always as pair here since there's no way to rely on that the application
> > will *not* call CoUnit somewhere in the middle of its processing.
>
> If it does, and it didnt' call CoInit, it is an application bug, and not
> our problem. Thats why there is the requirement to pair the calls - to
> allow us to call it once when we need it, and once on shutdown. If we
> need to call it once per thread, then IMO we simply set a per-thread
> flag when we have called it.

That's not the point.  The application *may* call CoInit() before
requesting the first path to a shortcut and it *may* call CoUninit()
before requesting another path to a shortcut, all in the same thread.
The CoInit/CoUnint brace in shortcut.c is safe against that:

    Application  Cygwin-DLL

    CoInit()
    lstat()    ->  CoInit()
                   CoUninit()
    CoUninit()
    lstat()    ->  CoInit()
                   CoUninit()

while storing our own state is not safe:

    Application  Cygwin-DLL

    CoInit()
                   CoInit()
    lstat()    ->  ok
    CoUninit()
    lstat()    ->  ???

To workaround that situation, Cygwin would have to call CoInit()
anyway to know it's state.  Since that requires to be balanced
according to MSDN...

Corinna

--
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

  reply	other threads:[~2002-09-03 16:05 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-02  8:20 A Simple Real World Benchmark for Cygwin Rick Richardson
2002-09-02  8:36 ` Ville Herva
2002-09-02  8:55 ` A Simple Real World Benchmark for cygwin Christopher Faylor
2002-09-02 14:34   ` Dan Vasaru
2002-09-02 15:02     ` Christopher Faylor
2002-09-03  1:28       ` Corinna Vinschen
2002-09-03  2:38         ` dvasaru
2002-09-03  4:52           ` Corinna Vinschen
2002-09-03  4:59             ` Robert Collins
2002-09-03  5:42               ` Corinna Vinschen
2002-09-03  9:05                 ` Dan Vasaru [this message]
2002-09-03 23:34                   ` Bjoern Kahl AG Resy
2002-09-04  1:55                     ` Corinna Vinschen
2002-09-04  2:10                       ` Bjoern Kahl AG Resy
2002-09-04  2:22                         ` Corinna Vinschen
2002-09-04 14:44                           ` BASH slow on network share scripts (was RE: A Simple Real World Benchmark for cygwin) Dan Vasaru
2002-09-04 20:07                             ` Christopher Faylor
2002-09-02  9:06 ` A Simple Real World Benchmark for Cygwin Michael Hoffman
2002-09-02 11:37   ` Randall R Schulz
2002-09-02 21:31   ` Jeremy Hetzler
2002-09-03 10:58 ` Eric M. Monsler
2002-09-04 10:54   ` Shankar Unni
2002-09-05 17:50 ` Randall R Schulz
2002-09-02  9:51 John Vincent
2002-09-02 10:36 ` Nicholas Wourms
2002-09-03  9:08 A Simple Real World Benchmark for cygwin Robb, Sam

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=CHEDKHJJDLOCCOFLMGEAOEIECLAA.dvasaru@broadpark.no \
    --to=dvasaru@broadpark.no \
    --cc=cygwin@cygwin.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).