ceph_context: replace semaphore with pipe/poll

sem_init and sem_timedwait are not portable, so we fake the locking here with pipe/poll, which we can also use with a timeout.

I'm aware of some issues surrounding the use of poll v.s. select in practice, but I don't have a deep understanding of the topic.