Hi,

I am having a problem porting Solaris R/W lock functionality to Linux. 
The problem is that RW_LOCK_HELD() doesn't have an equivalent function 
in pthreads.

This was not a problem before because RW_LOCK_HELD() was only used in 
ASSERT statements. In this case, I was able to make it work by making it 
behave a bit differently (specifically, it would return true if *any* 
thread was holding the lock, and false if there were no threads holding 
the lock. This way ASSERTs never failed).

However, now there is a small bit of code that actually relies on 
RW_LOCK_HELD() working correctly:

boolean_t need_lock = !RW_LOCK_HELD(&dp->dp_config_rwlock);

if (need_lock)
        rw_enter(&dp->dp_config_rwlock, RW_READER);

I can't think of a way to emulate this functionality with pthreads 
without incurring a huge overhead when locking...

Any ideas?

Thanks,
Ricardo

-- 
<http://www.sun.com>    

*Ricardo Manuel Correia*

Lustre Engineering
*Sun Microsystems, Inc.*
Portugal

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.opensolaris.org/pipermail/zfs-code/attachments/20071124/7c512a66/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 6g_top.gif
Type: image/gif
Size: 1257 bytes
Desc: not available
URL: 
<http://mail.opensolaris.org/pipermail/zfs-code/attachments/20071124/7c512a66/attachment.gif>

Reply via email to