This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Probably unnecessary InterlockedCompareExchangePointer inList_remove in thread.h


I am not sure, that is why I wrote "probably". But from what I see there is
already exclusive access guaranteed by the mx.lock() call, unless of course I
am completely misunderstanding something.

I can tell you that "lock; cmpxchg" pair of instruction is really not as cheap
as it looks. Especially on SMP systems. It takes above 100 of cycles on
contemporary CPUs.


VH



On Mon, 30 May 2005, Corinna Vinschen wrote:

> On May 29 17:03, Vaclav Haisman wrote:
> >
> > I think that the call to InterlockedCompareExchangePointer() can and should be
> > replaced by ordinary if and assignment. The synchronization it provides doesn't
> > seem to be necessary.
>
> Are you sure the synchronization isn't necessary?  You just say you think
> it isn't, but there's not much of a proof.  In any case, the call to
> InterlockedCompareExchangePointer is looking quite expensive, but it isn't.
> Did you notive there's a local file called winbase.h in the cygwin directory?
> If you have a look, you'll see that InterlockedCompareExchangePointer
> boils down to exactly one assembler instruction, so it doesn't seem to
> be worth the effort, does it?
>
>
> Corinna
>
> --
> Corinna Vinschen                  Please, send mails regarding Cygwin to
> Cygwin Project Co-Leader          mailto:cygwin@cygwin.com
> Red Hat, Inc.
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]