-
3 votesanswersviews
为什么命令std :: map和ordered std :: set不被邀请进行transaction_safe?
众所周知,实验C中有Transactional Memory TS(ISO / IEC TS 19841:2015):Is it enough to declare a function as transaction_safe, so they can be used thread-safe? 并且 operator[] 仅对容器声明为 transaction_safe : std::vector... -
4 votesanswersviews
将随机数生成添加到Haskell中的STM monad
我目前正在研究Haskell中的一些事务性内存基准测试,并希望能够在事务中使用随机数 . 我目前正在使用here中的Random monad / monad变换器 . 在下面的示例中,我有一个包含整数的TVar数组和一个随机选择数组中10个tvar的事务,例如: tvars :: STM (TArray Int Int) tvars = newArray (0, numTVars) 0 writ...