g*********s 发帖数: 1782 | 1 learning read/write locker and find the following on line:
http://doc.qt.nokia.com/qq/qq11-mutex.html
i just don't get it. how does it works? it seems to me lockWrite() just
directly set the semaphore to its max value. how are multiple writes
prevented? |
g*********s 发帖数: 1782 | 2 can any da niu share ideas of implementing class semaphore and class
rwlock using pthread mutex only?
【在 g*********s 的大作中提到】 : learning read/write locker and find the following on line: : http://doc.qt.nokia.com/qq/qq11-mutex.html : i just don't get it. how does it works? it seems to me lockWrite() just : directly set the semaphore to its max value. how are multiple writes : prevented?
|
t****t 发帖数: 6806 | 3 if you want pthread, pthread has rwlock...
【在 g*********s 的大作中提到】 : can any da niu share ideas of implementing class semaphore and class : rwlock using pthread mutex only?
|
g*********s 发帖数: 1782 | 4 i want to learn how to implement it.
somehow my pthread only has header and lib files. where can i find its
source code?
【在 t****t 的大作中提到】 : if you want pthread, pthread has rwlock...
|
p***o 发帖数: 1252 | 5 http://sourceware.org/pthreads-win32/
【在 g*********s 的大作中提到】 : i want to learn how to implement it. : somehow my pthread only has header and lib files. where can i find its : source code?
|
g*********s 发帖数: 1782 | 6 is it the same as linux version?
【在 p***o 的大作中提到】 : http://sourceware.org/pthreads-win32/
|
p***o 发帖数: 1252 | 7 Obviously the implementation is not.
【在 g*********s 的大作中提到】 : is it the same as linux version?
|
s**********o 发帖数: 197 | 8 for multiple writes, the first one fills semphore full gets in.
【在 g*********s 的大作中提到】 : learning read/write locker and find the following on line: : http://doc.qt.nokia.com/qq/qq11-mutex.html : i just don't get it. how does it works? it seems to me lockWrite() just : directly set the semaphore to its max value. how are multiple writes : prevented?
|
z***e 发帖数: 5393 | 9 It seems the semaphore is used to block readers.
so for "semaphore++", if semaphore reaches maxReaders, the instruction will
be blocked. That's why lockWrite() just set the semaphore to the max value
so no other reader thread will enter.
for multiple writes, it's protected by:
QMutexLocker locker(&mutex);
【在 g*********s 的大作中提到】 : learning read/write locker and find the following on line: : http://doc.qt.nokia.com/qq/qq11-mutex.html : i just don't get it. how does it works? it seems to me lockWrite() just : directly set the semaphore to its max value. how are multiple writes : prevented?
|