Re: Thread safe circular buffer.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greg Freemyer wrote:
> On 3/8/07, Tzahi Fadida <Tzahi.ML2@xxxxxxxxx> wrote:
>> On Thursday 08 March 2007 10:30, Anupam Kapoor wrote:
>> >
>> > don't use volatile in the kernel. straight from horse's mouth :
>>
>> I don't understand, LDD3 uses volatile in drivers. Now they say i can't.
>> What is the alternative?
>>
> Interesting, that thread is recommending "optimization barriers".  I
> wasn't familiar with those.
> 
> syntax example:
>> for (int i=0; i<10; i++)
>> {
>>     a[i] = *ina;
>>     barrier();
>>     b[i] = *inb;
>> }
> 
> And the description is:
>> It's a full optimization barrier; the compiler assumes all
>> register and memory content has changed from before the barrier(), and
>> it will start "fresh".

Which is *much* more pessimistic than "volatile".

~chill

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux