Re: Multithreading, callbacks from unknown threads [OT]
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Multithreading, callbacks from unknown threads [OT]
- From: Ross Bencina <rossb-lists@...>
- Date: 2012年3月17日 19:41:32 +1100
On 17/03/2012 7:11 PM, Gaspard Bucher wrote:
[1]
https://github.com/lubyk/lubyk/blob/master/modules/lk/include/lubyk/Fifo.h
With the exception of Visual C++2005 (and maybe later) where "volatile" 
also implies implicit memory barriers, the above linked code is not 
guaranteed to be safe.
Atomicity of the read and write pointers is not sufficient.
It is necessary to add processor memory barriers to ensure that the 
written data in the queue buffer is visible to the reader at the point 
that the reader sees the write pointer change.
Required memory barriers and barrier pairing will depend on the 
architecture.
Ross.
- References:
- Multithreading, callbacks from unknown threads, Thijs Schreijer
- Re: Multithreading, callbacks from unknown threads, Javier Guerra Giraldez
- RE: Multithreading, callbacks from unknown threads, Thijs Schreijer
- Re: Multithreading, callbacks from unknown threads, Javier Guerra Giraldez
- RE: Multithreading, callbacks from unknown threads, Thijs Schreijer
- Re: Multithreading, callbacks from unknown threads, Gaspard Bucher