refactor semaphore chan type