The check is unnecessary. In the worst case the semaphore gets unlocked
twice, but it's not an issue because the waiter is only interested in the
first sem_post(), and the semaphore is then not used anymore.
poll() is one of the heavily used methods and thus needs to be optimized
as much as possible.
Test on Pixracer: uorb_tests latency_test
Before:
uORB note: ---------------- LATENCY TEST ------------------
INFO [uorb_tests] mean: 40.4320 us
INFO [uorb_tests] std dev: 1.3466 us
INFO [uorb_tests] min: 39 us
INFO [uorb_tests] max: 57 us
INFO [uorb_tests] missed topic updates: 0
This Patch:
uORB note: ---------------- LATENCY TEST ------------------
INFO [uorb_tests] mean: 31.3480 us
INFO [uorb_tests] std dev: 1.4584 us
INFO [uorb_tests] min: 30 us
INFO [uorb_tests] max: 45 us
INFO [uorb_tests] missed topic updates: 0