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: [PATCH] Interlocked functions



On Thu, 15 Aug 2002, Christopher Faylor wrote:

> On Thu, Aug 15, 2002 at 09:38:52PM +0200, Thomas Pfaff wrote:
> >
> >With my mutex implementation i ran into the problem that the
> >InterlockedCompareExchange call ist not available on Win95.
> >
> >IMHO there exist 3 possibilities:
> >
> >Do not apply my mutexes :-(
> >Drop support for WIN95.
> >Create assembler versions of the interlocked functions. Now the code will
> >not on run on old i386 machines. This is my favourite solution.
> >
> >Chris has alreay created inline functions for Interlocked... in winbase.h,
> >i have added an ilockcmpexch and converted them into real functions in a
> >new file called winbase.c because i had some trouble with O2 optimization
> >and the inline functions.
>
> Argh.  So, you lose all of the inline optimization.  It sounds like you
> have to play with your implementation some more.
>
> The linux kernel manages to work fine with -O2 optimization.  There is no
> reason why we can't do the same.

This is surely true, but the problems that i had were not obvious and
reproducable.
It works most of the time but then the process started eating the cpu or
it crashed after ilockexch. I guess that a register has been modified that
shouldn't get modified but i couldn't see an error in my declarations.
You can be sure that i have tried very hard to get the inline versions
working.
Since the c functions are at least as fast as calling the real
Interlockeds in kernel32.dll i see no reason why not use them and play
with inline functions later.
I will try to divide the fork patch into smaller blocks first before i
will spend more time with inline assembler HowTos.

Thomas


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