Well, I was hoping someone more knowledgeable than myself would answer so I could learn something. I don't know how similar semaphores in Java are to semaphores in PHP but I had some trouble using the PEAR Weather package a while back causing "lock" errors.
AFAIK semaphores are kind of like locking a database during transactions except they're for resources and/or memory. In other words, if 2 or more script events are interacting with it at the same time, using semaphores stops things from breaking.
I tried to learn more about it at the time so I could fix it, but it was over my head so I ended up hacking that bit of code to get things "working". It didn't matter much as I was the only one using the script (experimenting), but if I ever need to use this on a live site I really should learn about it and understand it better.