use a semaphore instead of a rwlock (rwlock is not async aware)