[llvm-commits] CVS: llvm/lib/System/Mutex.cpp

Reid Spencer reid at x10sys.com
Tue Jul 12 23:38:02 PDT 2005


It makes sure that you get a process-wide rather than system-wide mutex.
Linux is okay but some operating systems default the mutex to system
wide which is unneeded for LLVM and *way* more expensive.  This call
just makes sure that we get a process-wide exception. We could probably
make it only be called on those systems that need it, but we're nit
picking nanoseconds here .. its a 2 line function that gets called, just
sets a value in a structure.

Reid.

On Wed, 2005-07-13 at 00:51 -0500, Chris Lattner wrote:
> What does this call do?  Is it even needed?
> 
> -Chris
> 
> On Tue, 12 Jul 2005, Reid Spencer wrote:
> 
> >
> >
> > Changes in directory llvm/lib/System:
> >
> > Mutex.cpp updated: 1.2 -> 1.3
> > ---
> > Log message:
> >
> > Don't call pthread_mutexattr_setpshared on FreeBSD because its implementation
> > of pthreads is missing that call (despite it violating the spec).
> >
> >
> > ---
> > Diffs of the changes:  (+2 -0)
> >
> > Mutex.cpp |    2 ++
> > 1 files changed, 2 insertions(+)
> >
> >
> > Index: llvm/lib/System/Mutex.cpp
> > diff -u llvm/lib/System/Mutex.cpp:1.2 llvm/lib/System/Mutex.cpp:1.3
> > --- llvm/lib/System/Mutex.cpp:1.2	Tue Jul 12 21:15:17 2005
> > +++ llvm/lib/System/Mutex.cpp	Tue Jul 12 22:02:06 2005
> > @@ -62,8 +62,10 @@
> >     errorcode = pthread_mutexattr_settype(&attr, kind);
> >     assert(errorcode == 0);
> >
> > +#ifndef __FreeBSD__
> >     // Make it a process local mutex
> >     errorcode = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE);
> > +#endif
> >
> >     // Initialize the mutex
> >     errorcode = pthread_mutex_init(mutex, &attr);
> >
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://mail.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >
> 
> -Chris
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20050712/d6273f5e/attachment.sig>


More information about the llvm-commits mailing list