managarm / mlibc

Portable C standard library
Other
851 stars 130 forks source link

Fix sem_trywait and linux sysdep pselect #1124

Closed Qwinci closed 1 month ago

Qwinci commented 1 month ago

Thanks for the fixes! How difficult is writing a regression test for this?

Probably not that hard, Ill write some tests for the semaphores.

Qwinci commented 1 month ago

Should be good now.

Geertiebear commented 1 month ago

Does that also include a regression test for the bug on sem_trywait()?

Qwinci commented 1 month ago

Does that also include a regression test for the bug on sem_trywait()?

Yes, the one that does 4 sem_trywaits in a row on a semaphore that only has 3 count. That would be where the fourth sem_trywait would incorrectly return 0 and the counter would wrap around.