Moving semaphore code to inside raw_channel so that clients don't have to care about it.