Change semaphores into resource counters.
Cosmetic fixes.
Merge pull request #39 from cybozu/counter

Change semaphores into resource counters.