Opened 3 years ago

Last modified 19 months ago

#16709 new bug

THR: Test FAILED - conformance/interfaces/pthread_rwlock_rdlock/2-3.test

Reported by: cocobean Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: System/POSIX Version: R1/Development
Keywords: POSIX, pthreads, pthread_rwlock_rdlock Cc:
Blocked By: Blocking:
Platform: All

Description

Test that pthread_rwlock_rdlock(pthread_rwlock_t *rwlock)

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 calling thread shall acquire the lock.

In this case, reader has higher priority than the writer

Steps: We have three threads, main(also a reader), writer, reader

1.  Main thread set its shcedule policy as "SCHED_FIFO", with highest priority the three: 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().
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()+1
6.  Reader thread read lock 'rwlock', shouldn't block, since it has a higher priority than the writer blocked on 'rwlock'
7.  Main thread release the 'rwlock', the writer should get the lock first.

NOTE: The test result is UNSUPPORTED if Thread Execution Scheduling option is not supported.

Ref: ​https://github.com/haiku/open_posix_testsuite/blob/from_haiku_trunk/conformance/interfaces/pthread_rwlock_rdlock/2-3.c

Expected result: Test passed

Actual Result: Test failed. rd_thread blocked on read lock

Tested on: Haiku hrev54815 x86 with Open POSIX Test Suite 1.5.2

Change History (1)

comment:1 by cocobean, 19 months ago

Last edited 19 months ago by cocobean (previous) (diff)
Note: See TracTickets for help on using tickets.