[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Patches] Does the implementation of pthread rwlock obey POSIX specification?



Hi All,

I not quit sure whether this is the right place to ask, if is not please tell me which mail list should I send to the mail, thanks.

When run the POSIX test, some cases about pthread rwlock fail. Test steps are as follow:

1.  Main thread set its shcedule policy as "SCHED_FIFO", with highest priority: sched_get_priority_min()+2.
2.  Main thread read lock 'rwlock'
3.  Create a writer thread, with schedule policy as "SCHED_FIFO", and priority using sched_get_priority_min()+1.
4.  The thread write lock 'rwlock', should block.
5.  Main thread create a reader thread, with schedule policy as "SCHED_FIFO", and priority sched_get_priority_min()
6.  Reader thread read lock 'rwlock', should block, since there is a higher priority  writer blocked on 'rwlock'

But the reader thread doesn't block. Because in  POSIX specification or pthread_rwlock_rdlock() manual page says:

       If  the  Thread  Execution Scheduling option is supported, and the threads involved in the lock are executing
       with the scheduling policies SCHED_FIFO or SCHED_RR, the calling thread shall  not  acquire  the  lock  if  a
       writer holds the lock or if writers of higher or equal priority are blocked on the lock; otherwise, the call‐
       ing thread shall acquire the lock.

So it seems the implementation of pthread rwlock doesn't obey the POSIX specification, right? If so, if there is a plan to
make eglibc  rwlock obey the POSIX specification?
I notice that there is a flag in pthread_rwlock_t to spec prefer read lock or right lock, but it doesn't care the priorities.

Any reply is appreciate.

Thanks,
Kai
_______________________________________________
Patches mailing list
Patches@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/patches