On February 1, 2015 06:45:22 AM Andrew Deryabin wrote:
> Hi again, Tim.
> 
> Just wondered, if this operation in `muse_atomic_set` can be considered
> safe? (i386 case)
> 
> `v->counter = i;`
> 
> It seems that it can be easily interrupted.
> 
> Regards,
> Andrew

I have read that modern processors such as Intel do such
 operations atomically so there's no need to take
 care of such things in code.

The i386 check is to see if it's an actual Intel processor
 and therefore OK to use that code.

Now, whether it is safe on an actual old 386 processor,
 not sure, maybe we should change it to __i686__
 or something...
I thought I read generally only Pentium supported this feature.

The issue for me is I know that my compiler knows about this
 i386, but my IDE shows it is not recognizing it.

I will check actual object code to see what's going on.

Tim.

> 
> 01.02.2015 05:54, Andrew Deryabin wrote:
> > Hi Tim,
> > 
> > Just made a check:
> > 
> > ------------
> > Konsole output
> > gcc -m32 -dM -E -x c /dev/null | grep 386
> > Konsole output
> > #define __i386 1
> > #define __i386__ 1
> > #define i386 1
> > ------------
> > ------------
> > Konsole output
> > clang -m32 -dM -E -x c /dev/null | grep 386
> > Konsole output
> > #define __i386 1
> > #define __i386__ 1
> > #define i386 1
> > ------------
> > 
> > So it seems, that all of these macros are defined both on gcc and clang.
> > 
> > Regards,
> > Andrew
> > 
> > 31.01.2015 23:58, Tim E. Real wrote:
> >> Hi.
> >> 
> >> I asked this before but can't remember, I think some said they got
> >> 
> >>   different results:
> >> Can you guys please simply check in the (new) file muse_atomic.h,
> >> 
> >>   and tell me if the sections marked "#ifndef i386" are active?
> >> 
> >> (I created this file and simply moved some code from another file into
> >> it.)
> >> 
> >> On all my systems (currently KUbuntu, Intel) the "#ifndef i386" sections
> >> 
> >>   have been active (as viewed in KDevelop) for as long as I can remember.
> >> 
> >> Yet the compiler actually knows about this i386 define - you can see it
> >> 
> >>   in a printout of a simple "test for compile defines" program.
> >> 
> >> I do not know if the compiler is actually compiling THOSE sections.
> >> I would need to check compiled objects...
> >> Just that KDevelop shows the sections as active.
> >> 
> >> I want to change the define test to "#ifndef __i386__" which works.
> >> But is that really correct? SHOULD it be i386 not __i386__?
> >> 
> >> This issue could be important, it means MusE might gain a good
> >> 
> >>   speed boost by using processor atomic features instead of calling
> >>   pthread_mutex_lock() !
> >> 
> >> Tim.
> >> 


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Lmuse-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lmuse-developer

Reply via email to