changed reentrant lock to semaphore (because we didn't want a reentrantlock..., seems to be robust to phone language changes now...