Opened 14 years ago

Closed 14 years ago

#5336 closed bug (fixed)

pthread_mutex_trylock() hangs

Reported by: kaliber Owned by: nobody
Priority: normal Milestone: R1
Component: System/POSIX Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

Change History (5)

comment:1 by bonefish, 14 years ago

Confirmed. The pthread_mutex_trylock() implementation is incorrect. It should not even touch the semaphore, but instead use atomic_test_and_set() on the count. Moreover the kernel's thread_block_with_timeout_locked() needs to check for an overflow in case B_TIMEOUT_REAL_TIME_BASE is set.

comment:2 by stippi, 14 years ago

I've looked into this problem a bit, but I am not quite sure why the pthread_mutex_trylock() implementation is the problem (also from talking to Axel). I understand that by doing what it does, it potentially converts a benaphore style mutex into a semaphore based one. Is the hanging problem then in the kernel implementation with the 0 absolute timeout? If pthread_mutex_trylock() only touches the count, how would it work when the mutex has alreasy been converted to be semaphore based?

comment:3 by stippi, 14 years ago

The WebCore trylock asserts work now (don't hang a WebPositive debug build on start-up anymore). Kaliber, can you please check if this bug is fixed for your test-cases as well?

in reply to:  3 comment:4 by kaliber, 14 years ago

Replying to stippi:

The WebCore trylock asserts work now (don't hang a WebPositive debug build on start-up anymore). Kaliber, can you please check if this bug is fixed for your test-cases as well?

Yes, it's fixed.

comment:5 by stippi, 14 years ago

Resolution: fixed
Status: newclosed

Nice. Fixed in hrev36323 then.

Note: See TracTickets for help on using tickets.