【 在 milksea (肥了,又肥了 >>>_<<<) 的大作中提到: 】
: 不懂 cond_var 不是 c++ 的问题吧,pthread 或者 windows api 里也都是一样的概念
你来了,太好了。
https://stackoverflow.com/questions/53286110/what-does-a-single-total-order-mean-in-stdnotify-one
The effects of notify_one()/notify_all() and each of the three atomic parts of wait()/wait_for()/wait_until() (unlock+wait, wakeup, and lock) take place in a single total order that can be viewed as modification order of an atomic variable: the order is specific to this individual condition_variable. This makes it impossible for notify_one() to, for example, be delayed and unblock a thread that started waiting just after the call to notify_one() was made.
What does it mean by saying "take place in a single total order"? How is this related to the next sentence "This makes it impossible ..... was made."? (It seems that it's telling a cause and effect).
I read it word by word more than 10 times and don't understand what it's saying.. Definition of "total order" from Wikipedia can't help much.
"偏序关系、全序关系都是公理集合论中的一种二元关系"。
我写了条知乎,但不知道对乎。total order是全序关系吗?pthread和Windows API,我还能看懂。再如vector的iterator,我是先知道的它,后看的设计模式。好像有本书叫做《用C++做设计》,北大翻译的那本书里也讲了些设计。我的意思是:有没有本书,讲std的设计和实现,例如cond_var调用了pthread吗?里面有几把锁,为什么…… 不用全讲,讲重点,数学少提一点,但可以给个链接,给有兴趣的人看,再如提句GOF的书里讲了iterator,没那么大兴趣的人,看完书后学到了(些)好的设计理念。不要搞成不先把离散数学和OS学好,就没法学C++了呀。20要上barrier了呀。
--
修改:billybear04 FROM 106.120.233.*
FROM 106.120.233.*