[cpp-threads] modes, interlude

Alexander Terekhov alexander.terekhov at gmail.com
Tue May 10 12:08:28 BST 2005


On 5/10/05, Doug Lea <dl at cs.oswego.edu> wrote:
[...]
> to use, although maybe still more pleasant than having to remember
> what "hsb" and the like mean :-) 

<quote>

[... allow_reordering pre, allow_reordering post ...]

enum allow_reordering is just { none, loads, stores, both }

</quote>

msync contraint(allow_reordering pre, allow_reordering post) 
{

  return ( ( pre == loads   ) ?     slb     :     // rel - ssb
           ( pre == stores  ) ?     ssb     :     // rel - slb
           ( pre == both    ) ? (slb + ssb) :     // rel
                                   none       ) +
         ( ( post == loads  ) ?     hlb     :     // acq - hsb
           ( post == stores ) ?     hsb     :     // acq - hlb
           ( post == both   ) ? (hlb + hsb) :     // acq
                                   none       ) ;
}

"contraint arithmetic". ;-)

regards,
alexander.




More information about the cpp-threads mailing list