svn commit: r215170 - in user/davidxu/libthr/sys: kern sys

David Xu davidxu at freebsd.org
Wed Nov 17 01:52:44 UTC 2010


Jilles Tjoelker wrote:
> On Fri, Nov 12, 2010 at 09:34:21AM +0000, David Xu wrote:
>> Author: davidxu
>> Date: Fri Nov 12 09:34:21 2010
>> New Revision: 215170
>> URL: http://svn.freebsd.org/changeset/base/215170
> 
>> Log:
>>   Limit total number of robust mutexes a process can hold.
> 
> I think a per thread limit is better as it is more predictable. If the
> limit is exceeded, pthread_mutex_lock() will fail.

per-thread limit is uncertain.
I don't know if I should let pthread_mutex_lock fail, because I saw
so much code do not check error code, unlike java, C programmer tends to
ignore error code, while java can throw exception in abnormal
case, force you to handle it. I even want to change default mutex from
error-check to normal.

> 
>> [...]
>> +			error = msleep(&max_robust_per_proc,
>> +				&max_robust_lock, 0, "maxrob", 0);
> 
> I think a PCATCH flag was intended here.
> 
> If you want to do it this way, it needs to wake up if another thread in
> the process unlocks something.
> 
Good catch.

> If one thread uses up max_robust_per_proc, it is stuck forever. It is
> also possible though rare that this wait forms a cycle with lock waits.
> 

Yes


More information about the svn-src-user mailing list