[strongSwan-dev] [PATCH] log: do not acquire lock if nobody is listening
Tobias Brunner
tobias at strongswan.org
Thu Apr 24 18:23:39 CEST 2014
Hi Christoph,
Thanks for testing the code.
>> The check is disabled completely if these built-ins are not available,
>> because fallbacks (like those for ref_*) would not improve the
>> performance. But since even the atomic implementation allows races an
>> alternative approach would be to use __atomic* if available and just
>> directly read and write if not (thus avoiding the __sync penalty). We
>> could make max_[v]level an int32_t array to be reasonably safe.
>
> This sounds reasonable to simply read and write when atomic macros are
> not available. I may be wrong, but I think that modern processors always
> read or write an int32_t atomically, provided it is aligned on a 32 bit
> boundary.
I think so too, but I feel safer not relying on assumptions :) So I
merged the branch as is.
Regards,
Tobias
More information about the Dev
mailing list