Semaphore implementation for the Perl AnyEvent framework