[llvm-commits] [compiler-rt] r153735 - /compiler-rt/trunk/lib/atomic.c

David Chisnall csdavec at swan.ac.uk
Fri Mar 30 01:57:23 PDT 2012


Hi Anton,

On 30 Mar 2012, at 09:43, Anton Korobeynikov wrote:

> Hi David
> 
>> +////////////////////////////////////////////////////////////////////////////////
>> +// Platform-specific lock implementation.  Falls back to spinlocks if none is
>> +// defined.  Each platform should define the Lock type, and corresponding
>> +// lock() and unlock() functions.
>> +////////////////////////////////////////////////////////////////////////////////
>> +#ifdef __FreeBSD__
>> +#include <errno.h>
>> +#include <sys/types.h>
>> +#include <machine/atomic.h>
>> +#include <sys/umtx.h>
> If every platform should add stuff here - maybe we'd better go via
> platform-per-file approach? Instead of having bunch of independent
> code in the single file?

I wondered about that, but since it's only two functions (which are optional - there is a generic fall-back implementation if they're not used), which are likely to be under five lines each, a separate file for each seemed like overkill.  I don't have strong opinion either way though, so if it becomes more maintainable to refactor them into separate files then I'm fine with that too.

David

> -- 
> With best regards, Anton Korobeynikov
> Faculty of Mathematics and Mechanics, Saint Petersburg State University





More information about the llvm-commits mailing list