Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, December 2007
Recursive use of QReadWriteLock


Message 1 in thread

Hi All,

I'm using QReadWriteLock to protect a class.
As soon as I'm in a recursive lock for read and a lock for write from 
another thread comes in, the write lock gets priority which leads to a 
dead lock. Imho i think that no recursive lock should be blocked.

Is this a known bug?
Or is it a feature? ;)

Thanks,
Marko

--
 [ signature omitted ] 

Message 2 in thread

Marko Doering wrote:
>Hi All,
>
>I'm using QReadWriteLock to protect a class.
>As soon as I'm in a recursive lock for read and a lock for write from
>another thread comes in, the write lock gets priority which leads to a
>dead lock. Imho i think that no recursive lock should be blocked.

How is that a deadlock? Requests for write locks are given priority, true. 
So?

As soon as the write lock goes away, the read locks will be served. 
There's no deadlock.

-- 
 [ signature omitted ] 

Attachment: signature.asc
Description: This is a digitally signed message part.


Message 3 in thread

Marko Doering wrote:
> Hi All,
> 
> I'm using QReadWriteLock to protect a class.
> As soon as I'm in a recursive lock for read and a lock for write from 
> another thread comes in, the write lock gets priority which leads to a 
> dead lock. Imho i think that no recursive lock should be blocked.
> 
> Is this a known bug?

Sounds like 
http://trolltech.com/developer/task-tracker/index_html?id=131880&method=entry 
to me :)

> Or is it a feature? ;)

Definitely not. Recursive read lock support is a bit tricky when writers get 
preference (as you pointed out). In 4.4, QReadWriteLock now has a constructor 
to put it into recursive mode (like QMutex): 
http://doc.trolltech.com/main-snapshot/qreadwritelock.html#QReadWriteLock-2

-- 
 [ signature omitted ] 

Message 4 in thread

unsubscribe rajeshwari.trivedi@xxxxxxxxx




The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
 
www.wipro.com

Message 5 in thread

Many thanks for your fast answer!
I'll try the 4.4 version.

Bradley T Hughes wrote:
> Marko Doering wrote:
>> Hi All,
>>
>> I'm using QReadWriteLock to protect a class.
>> As soon as I'm in a recursive lock for read and a lock for write from 
>> another thread comes in, the write lock gets priority which leads to a 
>> dead lock. Imho i think that no recursive lock should be blocked.
>>
>> Is this a known bug?
> 
> Sounds like 
> http://trolltech.com/developer/task-tracker/index_html?id=131880&method=entry 
> to me :)
> 
>> Or is it a feature? ;)
> 
> Definitely not. Recursive read lock support is a bit tricky when writers 
> get preference (as you pointed out). In 4.4, QReadWriteLock now has a 
> constructor to put it into recursive mode (like QMutex): 
> http://doc.trolltech.com/main-snapshot/qreadwritelock.html#QReadWriteLock-2
> 

--
 [ signature omitted ]