24 lines
563 B
Markdown
24 lines
563 B
Markdown
|
|
![[第20章(1课时)已更新.ppt]]
|
|||
|
|
QWaitCondition的使用
|
|||
|
|
![[7941646ae9f8aeb7212bf21961ac0b79_.png]]
|
|||
|
|
![[ce35786fa07e588a9538c0dad8daf521_.png]]
|
|||
|
|
![[278efd24a2830685a4398e4f1faa1194_.png]]
|
|||
|
|
"1thread" 0
|
|||
|
|
"1thread" 1
|
|||
|
|
"1thread" 2
|
|||
|
|
"1thread" 3
|
|||
|
|
"1thread" 4
|
|||
|
|
"1thread" 5
|
|||
|
|
"1thread" 6
|
|||
|
|
"1thread" 7 这里已经满了,无法生产了
|
|||
|
|
"2thread" 0 消费一个之后
|
|||
|
|
"1thread" 8 才能继续生产
|
|||
|
|
"2thread" 1
|
|||
|
|
"1thread" 9
|
|||
|
|
"2thread" 9
|
|||
|
|
![[3451d9c3e1cfa4f092b55089d9a871b2_.png]]
|
|||
|
|
使用两个线程是这样的。
|
|||
|
|
![[threadclock.cpp]]
|
|||
|
|
![[GlobalData.h]]
|
|||
|
|
![[threadclock.h]]
|