I have an implementation of a bi-directional message channel which, to reduce overhead, I implemented as a couple of circular buffers of messages. To write from one end to t
A file descriptor is an index into a kernel-managed array of open files and similar objects (pipes, FIFOs, sockets), so it's not possible to associate a file descriptor with anything not managed by the kernel.
If your message channels and semaphores are entirely in user space (implemented in your own application with recourse to system calls), then you can't get a file descriptor for it. Sorry.
It's a bit of a hack, but you could replace your condition variable with a pipe. The read thread would poll/select on the read side and the socket. The thread that writes to your buffer also writes a byte to the pipe to signal there is stuff in the buffer.
Generally, no. But different OSes offer different solutions for the problem you have.
You can associate an event with a socket with WSAEventSelect and wait with WaitForMultipleObjectsEx for the data on the socket or mutex or semaphore event etc.
You can use the futex syscall with FUTEX_FD argument (however this has been removed from the kernel), or use eventfd to implement the condition variable.
And you can spawn a second thread that would be waiting on the condition variable, and signal the one waiting in select(). Or ask for signals when input is received on the socket, etc. See this related question.